From 13a01b2f2278ff1d5b77e799b1810d1835403305 Mon Sep 17 00:00:00 2001 From: Neel Shah Date: Wed, 12 Aug 2026 16:26:48 +0200 Subject: [PATCH] feat!: Remove enable_logs --- .../lib/sentry/rails/configuration.rb | 6 +---- .../action_controller_subscriber.rb | 1 - .../action_mailer_subscriber.rb | 1 - .../log_subscribers/active_job_subscriber.rb | 1 - .../active_record_subscriber.rb | 1 - sentry-rails/lib/sentry/rails/railtie.rb | 2 +- .../shared_examples/structured_logging.rb | 1 - .../tracing/user_propagation.rb | 1 - .../spec/active_job/support/harness.rb | 2 +- .../spec/isolated/rails_logger_patch_spec.rb | 2 -- .../spec/sentry/rails/configuration_spec.rb | 17 +++--------- .../spec/sentry/rails/log_subscriber_spec.rb | 2 -- .../action_controller_subscriber_spec.rb | 6 +---- .../action_mailer_subscriber_spec.rb | 6 +---- .../active_job_subscriber_spec.rb | 6 +---- .../active_record_subscriber_spec.rb | 10 ++----- .../sentry/rails/structured_logging_spec.rb | 26 +++---------------- sentry-rails/spec/sentry/rails_spec.rb | 3 +++ sentry-ruby/lib/sentry-ruby.rb | 12 ++------- sentry-ruby/lib/sentry/client.rb | 4 +-- sentry-ruby/lib/sentry/configuration.rb | 5 ---- .../lib/sentry/debug_structured_logger.rb | 17 ++---------- sentry-ruby/lib/sentry/hub.rb | 2 +- sentry-ruby/lib/sentry/std_lib_logger.rb | 8 ++---- sentry-ruby/lib/sentry/test_helper.rb | 4 +-- .../spec/isolated/sentry_logger_spec.rb | 1 - .../spec/isolated/std_lib_logger_spec.rb | 23 +++------------- .../sentry/debug_structured_logger_spec.rb | 14 ---------- .../spec/sentry/log_event_buffer_spec.rb | 3 +-- .../spec/sentry/metric_event_buffer_spec.rb | 3 +-- .../spec/sentry/structured_logger_spec.rb | 14 ---------- sentry-ruby/spec/sentry_spec.rb | 1 - ...ed_examples_for_telemetry_event_buffers.rb | 3 +-- spec/apps/rails-mini/app.rb | 1 - spec/spec_helper.rb | 1 - 35 files changed, 32 insertions(+), 178 deletions(-) diff --git a/sentry-rails/lib/sentry/rails/configuration.rb b/sentry-rails/lib/sentry/rails/configuration.rb index 9e4c1e7ef..efb6cf08f 100644 --- a/sentry-rails/lib/sentry/rails/configuration.rb +++ b/sentry-rails/lib/sentry/rails/configuration.rb @@ -33,10 +33,6 @@ class Configuration end end end - - after(:configured) do - rails.structured_logging.enabled = enable_logs if rails.structured_logging.enabled.nil? - end end module Rails @@ -218,7 +214,7 @@ class StructuredLoggingConfiguration }.freeze def initialize - @enabled = nil + @enabled = false @subscribers = DEFAULT_SUBSCRIBERS.dup end diff --git a/sentry-rails/lib/sentry/rails/log_subscribers/action_controller_subscriber.rb b/sentry-rails/lib/sentry/rails/log_subscribers/action_controller_subscriber.rb index 4b317e564..6dd78742d 100644 --- a/sentry-rails/lib/sentry/rails/log_subscribers/action_controller_subscriber.rb +++ b/sentry-rails/lib/sentry/rails/log_subscribers/action_controller_subscriber.rb @@ -16,7 +16,6 @@ module LogSubscribers # @example Usage # # Enable structured logging for ActionController # Sentry.init do |config| - # config.enable_logs = true # config.rails.structured_logging = true # config.rails.structured_logging.subscribers = { action_controller: Sentry::Rails::LogSubscribers::ActionControllerSubscriber } # end diff --git a/sentry-rails/lib/sentry/rails/log_subscribers/action_mailer_subscriber.rb b/sentry-rails/lib/sentry/rails/log_subscribers/action_mailer_subscriber.rb index 2d8237fb7..0aa75b57e 100644 --- a/sentry-rails/lib/sentry/rails/log_subscribers/action_mailer_subscriber.rb +++ b/sentry-rails/lib/sentry/rails/log_subscribers/action_mailer_subscriber.rb @@ -15,7 +15,6 @@ module LogSubscribers # @example Usage # # Enable structured logging for ActionMailer # Sentry.init do |config| - # config.enable_logs = true # config.rails.structured_logging = true # config.rails.structured_logging.subscribers = { action_mailer: Sentry::Rails::LogSubscribers::ActionMailerSubscriber } # end diff --git a/sentry-rails/lib/sentry/rails/log_subscribers/active_job_subscriber.rb b/sentry-rails/lib/sentry/rails/log_subscribers/active_job_subscriber.rb index da3353894..1a115cdf0 100644 --- a/sentry-rails/lib/sentry/rails/log_subscribers/active_job_subscriber.rb +++ b/sentry-rails/lib/sentry/rails/log_subscribers/active_job_subscriber.rb @@ -15,7 +15,6 @@ module LogSubscribers # @example Usage # # Enable structured logging for ActiveJob # Sentry.init do |config| - # config.enable_logs = true # config.rails.structured_logging = true # config.rails.structured_logging.subscribers = { active_job: Sentry::Rails::LogSubscribers::ActiveJobSubscriber } # end diff --git a/sentry-rails/lib/sentry/rails/log_subscribers/active_record_subscriber.rb b/sentry-rails/lib/sentry/rails/log_subscribers/active_record_subscriber.rb index ad0f7d642..6c01356bf 100644 --- a/sentry-rails/lib/sentry/rails/log_subscribers/active_record_subscriber.rb +++ b/sentry-rails/lib/sentry/rails/log_subscribers/active_record_subscriber.rb @@ -16,7 +16,6 @@ module LogSubscribers # @example Usage # # Automatically attached when structured logging is enabled for :active_record # Sentry.init do |config| - # config.enable_logs = true # config.rails.structured_logging = true # config.rails.structured_logging.subscribers = { active_record: Sentry::Rails::LogSubscribers::ActiveRecordSubscriber } # end diff --git a/sentry-rails/lib/sentry/rails/railtie.rb b/sentry-rails/lib/sentry/rails/railtie.rb index a234e95a9..d997e5c46 100644 --- a/sentry-rails/lib/sentry/rails/railtie.rb +++ b/sentry-rails/lib/sentry/rails/railtie.rb @@ -142,7 +142,7 @@ def activate_tracing end def activate_structured_logging - if Sentry.configuration.rails.structured_logging.enabled? && Sentry.configuration.enable_logs + if Sentry.configuration.rails.structured_logging.enabled? Sentry::Rails::StructuredLogging.attach(Sentry.configuration.rails.structured_logging) end end diff --git a/sentry-rails/spec/active_job/shared_examples/structured_logging.rb b/sentry-rails/spec/active_job/shared_examples/structured_logging.rb index 7a6fbc5df..b194347f0 100644 --- a/sentry-rails/spec/active_job/shared_examples/structured_logging.rb +++ b/sentry-rails/spec/active_job/shared_examples/structured_logging.rb @@ -3,7 +3,6 @@ RSpec.shared_examples "an ActiveJob backend that produces structured logs" do let(:configure_sentry) do proc do |config, _app| - config.enable_logs = true config.rails.structured_logging.enabled = true config.rails.structured_logging.subscribers = { active_job: Sentry::Rails::LogSubscribers::ActiveJobSubscriber diff --git a/sentry-rails/spec/active_job/shared_examples/tracing/user_propagation.rb b/sentry-rails/spec/active_job/shared_examples/tracing/user_propagation.rb index 52dd9df5e..5b94f42f8 100644 --- a/sentry-rails/spec/active_job/shared_examples/tracing/user_propagation.rb +++ b/sentry-rails/spec/active_job/shared_examples/tracing/user_propagation.rb @@ -63,7 +63,6 @@ proc do |config| config.traces_sample_rate = 1.0 config.send_default_pii = true - config.enable_logs = true end end diff --git a/sentry-rails/spec/active_job/support/harness.rb b/sentry-rails/spec/active_job/support/harness.rb index 710492121..881945dfb 100644 --- a/sentry-rails/spec/active_job/support/harness.rb +++ b/sentry-rails/spec/active_job/support/harness.rb @@ -73,7 +73,7 @@ def perform(*_args, **_kwargs) Sentry::Rails::Tracing.patch_active_support_notifications end - if Sentry.configuration.rails.structured_logging.enabled? && Sentry.configuration.enable_logs + if Sentry.configuration.rails.structured_logging.enabled? Sentry::Rails::StructuredLogging.attach(Sentry.configuration.rails.structured_logging) end diff --git a/sentry-rails/spec/isolated/rails_logger_patch_spec.rb b/sentry-rails/spec/isolated/rails_logger_patch_spec.rb index 5e4f905ab..8f8a52d18 100644 --- a/sentry-rails/spec/isolated/rails_logger_patch_spec.rb +++ b/sentry-rails/spec/isolated/rails_logger_patch_spec.rb @@ -10,7 +10,6 @@ context "when :logger patch is enabled" do before do make_basic_app do |config, app| - config.enable_logs = true config.enabled_patches = [:logger] config.max_log_events = 10 config.sdk_logger = Logger.new(nil) @@ -202,7 +201,6 @@ let(:broadcast_logger) { ActiveSupport::BroadcastLogger.new(logger1, logger2) } let(:broadcast_app) do make_basic_app do |config| - config.enable_logs = true config.enabled_patches = [:logger] config.max_log_events = 10 config.sdk_logger = Logger.new(nil) diff --git a/sentry-rails/spec/sentry/rails/configuration_spec.rb b/sentry-rails/spec/sentry/rails/configuration_spec.rb index 6988d205d..f45e61a0d 100644 --- a/sentry-rails/spec/sentry/rails/configuration_spec.rb +++ b/sentry-rails/spec/sentry/rails/configuration_spec.rb @@ -99,26 +99,15 @@ class MySubscriber; end expect(config.structured_logging.subscribers).to be_a(Hash) end - it "auto-enables when enable_logs is true and not explicitly set" do - make_basic_app do |config| - config.enable_logs = true - end - - expect(config.structured_logging.enabled?).to be(true) - end - - it "remains disabled when enable_logs is false" do - make_basic_app do |config| - config.enable_logs = false - end + it "disables structured logging by default" do + make_basic_app expect(config.structured_logging.enabled?).to be(false) end - it "respects explicit disable even when enable_logs is true" do + it "respects explicit disable" do make_basic_app do |config| config.rails.structured_logging.enabled = false - config.enable_logs = true end expect(config.structured_logging.enabled?).to be(false) diff --git a/sentry-rails/spec/sentry/rails/log_subscriber_spec.rb b/sentry-rails/spec/sentry/rails/log_subscriber_spec.rb index 7b0844a09..03385fe72 100644 --- a/sentry-rails/spec/sentry/rails/log_subscriber_spec.rb +++ b/sentry-rails/spec/sentry/rails/log_subscriber_spec.rb @@ -43,7 +43,6 @@ def error_test_event(event) before do make_basic_app do |config| - config.enable_logs = true config.structured_logging.logger_class = Sentry::DebugStructuredLogger # Disable default structured logging subscribers to avoid interference config.rails.structured_logging.enabled = false @@ -243,7 +242,6 @@ def filtering_event(event) before do make_basic_app do |config, app| - config.enable_logs = true config.structured_logging.logger_class = Sentry::DebugStructuredLogger config.send_default_pii = true end diff --git a/sentry-rails/spec/sentry/rails/log_subscribers/action_controller_subscriber_spec.rb b/sentry-rails/spec/sentry/rails/log_subscribers/action_controller_subscriber_spec.rb index 19de73b28..45386fef6 100644 --- a/sentry-rails/spec/sentry/rails/log_subscribers/action_controller_subscriber_spec.rb +++ b/sentry-rails/spec/sentry/rails/log_subscribers/action_controller_subscriber_spec.rb @@ -6,8 +6,6 @@ context "when logging is enabled" do before do make_basic_app do |config, app| - config.enable_logs = true - config.rails.structured_logging.enabled = true config.rails.structured_logging.subscribers = { action_controller: Sentry::Rails::LogSubscribers::ActionControllerSubscriber } end @@ -380,9 +378,7 @@ context "when logging is disabled" do before do make_basic_app do |config| - config.enable_logs = false - - config.rails.structured_logging.enabled = true + config.rails.structured_logging.enabled = false config.rails.structured_logging.subscribers = { action_controller: Sentry::Rails::LogSubscribers::ActionControllerSubscriber } end end diff --git a/sentry-rails/spec/sentry/rails/log_subscribers/action_mailer_subscriber_spec.rb b/sentry-rails/spec/sentry/rails/log_subscribers/action_mailer_subscriber_spec.rb index 2ac0c1de5..611ba31fc 100644 --- a/sentry-rails/spec/sentry/rails/log_subscribers/action_mailer_subscriber_spec.rb +++ b/sentry-rails/spec/sentry/rails/log_subscribers/action_mailer_subscriber_spec.rb @@ -6,8 +6,6 @@ context "when logging is enabled" do before do make_basic_app do |config| - config.enable_logs = true - config.rails.structured_logging.enabled = true config.rails.structured_logging.subscribers = { action_mailer: Sentry::Rails::LogSubscribers::ActionMailerSubscriber } end @@ -230,9 +228,7 @@ context "when logging is disabled" do before do make_basic_app do |config| - config.enable_logs = false - - config.rails.structured_logging.enabled = true + config.rails.structured_logging.enabled = false config.rails.structured_logging.subscribers = { action_mailer: Sentry::Rails::LogSubscribers::ActionMailerSubscriber } end end diff --git a/sentry-rails/spec/sentry/rails/log_subscribers/active_job_subscriber_spec.rb b/sentry-rails/spec/sentry/rails/log_subscribers/active_job_subscriber_spec.rb index d65f85780..4f42983a5 100644 --- a/sentry-rails/spec/sentry/rails/log_subscribers/active_job_subscriber_spec.rb +++ b/sentry-rails/spec/sentry/rails/log_subscribers/active_job_subscriber_spec.rb @@ -6,8 +6,6 @@ context "when logging is enabled" do before do make_basic_app do |config| - config.enable_logs = true - config.rails.structured_logging.enabled = true config.rails.structured_logging.subscribers = { active_job: Sentry::Rails::LogSubscribers::ActiveJobSubscriber } end @@ -329,9 +327,7 @@ def perform(*args, **kwargs) context "when logging is disabled" do before do make_basic_app do |config| - config.enable_logs = false - - config.rails.structured_logging.enabled = true + config.rails.structured_logging.enabled = false config.rails.structured_logging.subscribers = { active_job: Sentry::Rails::LogSubscribers::ActiveJobSubscriber } end end diff --git a/sentry-rails/spec/sentry/rails/log_subscribers/active_record_subscriber_spec.rb b/sentry-rails/spec/sentry/rails/log_subscribers/active_record_subscriber_spec.rb index 680492e97..7b51071ea 100644 --- a/sentry-rails/spec/sentry/rails/log_subscribers/active_record_subscriber_spec.rb +++ b/sentry-rails/spec/sentry/rails/log_subscribers/active_record_subscriber_spec.rb @@ -6,8 +6,6 @@ context "when logging is enabled" do before do make_basic_app do |config| - config.enable_logs = true - config.rails.structured_logging.enabled = true config.rails.structured_logging.subscribers = { active_record: Sentry::Rails::LogSubscribers::ActiveRecordSubscriber } end @@ -62,7 +60,7 @@ sentry_transport.events.clear sentry_transport.envelopes.clear - created_at = Time.new(2025, 10, 28, 13, 11, 44) + created_at = Time.utc(2025, 10, 28, 13, 11, 44) Post.where(id: post.id, title: post.title, created_at: created_at).to_a Sentry.get_current_client.flush @@ -350,8 +348,6 @@ context "when logger is silenced" do before do make_basic_app do |config, app| - config.enable_logs = true - config.rails.structured_logging.enabled = true config.rails.structured_logging.subscribers = { active_record: Sentry::Rails::LogSubscribers::ActiveRecordSubscriber @@ -380,9 +376,7 @@ context "when logging is disabled" do before do make_basic_app do |config| - config.enable_logs = false - - config.rails.structured_logging.enabled = true + config.rails.structured_logging.enabled = false config.rails.structured_logging.subscribers = { active_record: Sentry::Rails::LogSubscribers::ActiveRecordSubscriber } end end diff --git a/sentry-rails/spec/sentry/rails/structured_logging_spec.rb b/sentry-rails/spec/sentry/rails/structured_logging_spec.rb index 14f0fd86a..4d9ad9894 100644 --- a/sentry-rails/spec/sentry/rails/structured_logging_spec.rb +++ b/sentry-rails/spec/sentry/rails/structured_logging_spec.rb @@ -3,29 +3,9 @@ require "spec_helper" RSpec.describe Sentry::Rails::StructuredLogging, type: :request do - context "when sentry structured logging is disabled" do - before do - make_basic_app do |config| - config.enable_logs = false - config.rails.structured_logging.enabled = true - end - end - - it "does not capture structured logs" do - get "/posts" - - Post.first - - Sentry.get_current_client.flush - - expect(sentry_logs).to be_empty - end - end - context "when rails structured logging is disabled" do before do make_basic_app do |config| - config.enable_logs = true config.rails.structured_logging.enabled = false end end @@ -41,14 +21,14 @@ end end - context "when enable_logs is true and structured logging is auto-enabled" do + context "when structured logging is enabled" do before do make_basic_app do |config| - config.enable_logs = true + config.rails.structured_logging.enabled = true end end - it "captures structured logs automatically" do + it "captures structured logs" do get "/posts" Post.first diff --git a/sentry-rails/spec/sentry/rails_spec.rb b/sentry-rails/spec/sentry/rails_spec.rb index e487dfdc8..55a29e75a 100644 --- a/sentry-rails/spec/sentry/rails_spec.rb +++ b/sentry-rails/spec/sentry/rails_spec.rb @@ -64,11 +64,14 @@ end it "doesn't cause error if Rails::Logger is not present during SDK initialization" do + rails_logger = Rails.logger Rails.logger = nil Sentry.init expect(Sentry.configuration.sdk_logger).to be_a(Sentry::Logger) + ensure + Rails.logger = rails_logger end end diff --git a/sentry-ruby/lib/sentry-ruby.rb b/sentry-ruby/lib/sentry-ruby.rb index b9c072629..2c4de3107 100644 --- a/sentry-ruby/lib/sentry-ruby.rb +++ b/sentry-ruby/lib/sentry-ruby.rb @@ -527,7 +527,7 @@ def capture_check_in(slug, status, **options) # Sentry.capture_log("User logged in", level: :info, user_id: 123) # # @see https://develop.sentry.dev/sdk/telemetry/logs/ Sentry SDK Telemetry Logs Protocol - # @return [LogEvent, nil] The created log event or nil if logging is disabled + # @return [LogEvent, nil] The created log event or nil if Sentry is not initialized def capture_log(message, **options) return unless initialized? get_current_hub.capture_log_event(message, **options) @@ -639,14 +639,6 @@ def continue_trace(env, **options) # Returns the structured logger instance that implements Sentry's SDK telemetry logs protocol. # - # This logger is only available when logs are enabled in the configuration. - # - # @example Enable logs in configuration - # Sentry.init do |config| - # config.dsn = "YOUR_DSN" - # config.enable_logs = true - # end - # # @example Basic usage # Sentry.logger.info("User logged in successfully", user_id: 123) # Sentry.logger.error("Failed to process payment", @@ -656,7 +648,7 @@ def continue_trace(env, **options) # # @see https://develop.sentry.dev/sdk/telemetry/logs/ Sentry SDK Telemetry Logs Protocol # - # @return [StructuredLogger] The structured logger instance or nil if logs are disabled + # @return [StructuredLogger] The structured logger instance def logger @logger ||= configuration.structured_logging.logger_class.new(configuration) end diff --git a/sentry-ruby/lib/sentry/client.rb b/sentry-ruby/lib/sentry/client.rb index e1571e8c8..bc6c10296 100644 --- a/sentry-ruby/lib/sentry/client.rb +++ b/sentry-ruby/lib/sentry/client.rb @@ -48,9 +48,7 @@ def initialize(configuration) @spotlight_transport = SpotlightTransport.new(configuration) if configuration.spotlight - if configuration.enable_logs - @log_event_buffer = LogEventBuffer.new(configuration, self) - end + @log_event_buffer = LogEventBuffer.new(configuration, self) if configuration.enable_metrics @metric_event_buffer = MetricEventBuffer.new(configuration, self) diff --git a/sentry-ruby/lib/sentry/configuration.rb b/sentry-ruby/lib/sentry/configuration.rb index 6c1f23527..9530ffd5c 100644 --- a/sentry-ruby/lib/sentry/configuration.rb +++ b/sentry-ruby/lib/sentry/configuration.rb @@ -273,10 +273,6 @@ class Configuration # @return [Proc] attr_accessor :traces_sampler - # Enable Structured Logging - # @return [Boolean] - attr_accessor :enable_logs - # Structured logging configuration. # @return [StructuredLoggingConfiguration] attr_reader :structured_logging @@ -578,7 +574,6 @@ def initialize self.std_lib_logger_filter = nil self.rack_env_whitelist = RACK_ENV_WHITELIST_DEFAULT self.traces_sampler = nil - self.enable_logs = false self.enable_metrics = true self.profiler_class = Sentry::Profiler diff --git a/sentry-ruby/lib/sentry/debug_structured_logger.rb b/sentry-ruby/lib/sentry/debug_structured_logger.rb index 2e5835a4b..d7e23c80a 100644 --- a/sentry-ruby/lib/sentry/debug_structured_logger.rb +++ b/sentry-ruby/lib/sentry/debug_structured_logger.rb @@ -8,8 +8,7 @@ module Sentry # DebugStructuredLogger is a logger that captures structured log events to a file for debugging purposes. # - # It can optionally also send log events to Sentry via the normal structured logger if logging - # is enabled. + # It also sends log events to Sentry via the normal structured logger. class DebugStructuredLogger < SimpleDelegator DEFAULT_LOG_FILE_PATH = File.join("log", "sentry_debug_logs.log") @@ -68,12 +67,7 @@ def clear private def initialize_backend(configuration) - if configuration.enable_logs - StructuredLogger.new(configuration) - else - # Create a no-op logger if logging is disabled - NoOpLogger.new - end + StructuredLogger.new(configuration) end def initialize_log_file(log_file_path) @@ -83,12 +77,5 @@ def initialize_log_file(log_file_path) log_file end - - # No-op logger for when structured logging is disabled - class NoOpLogger - %i[trace debug info warn error fatal log].each do |method| - define_method(method) { |*args, **kwargs| nil } - end - end end end diff --git a/sentry-ruby/lib/sentry/hub.rb b/sentry-ruby/lib/sentry/hub.rb index 5f99edb71..935f9f071 100644 --- a/sentry-ruby/lib/sentry/hub.rb +++ b/sentry-ruby/lib/sentry/hub.rb @@ -224,7 +224,7 @@ def capture_check_in(slug, status, **options) end def capture_log_event(message, **options) - return unless current_client && current_client.configuration.enable_logs + return unless current_client event = current_client.event_from_log(message, **options) diff --git a/sentry-ruby/lib/sentry/std_lib_logger.rb b/sentry-ruby/lib/sentry/std_lib_logger.rb index f51bd74d4..83bdd9a5a 100644 --- a/sentry-ruby/lib/sentry/std_lib_logger.rb +++ b/sentry-ruby/lib/sentry/std_lib_logger.rb @@ -50,10 +50,6 @@ def add(severity, message = nil, progname = nil, &block) end end -Sentry.register_patch(:logger) do |config| - if config.enable_logs - ::Logger.prepend(Sentry::StdLibLogger) - else - config.sdk_logger.warn(":logger patch enabled but `enable_logs` is turned off - skipping applying patch") - end +Sentry.register_patch(:logger) do + ::Logger.prepend(Sentry::StdLibLogger) end diff --git a/sentry-ruby/lib/sentry/test_helper.rb b/sentry-ruby/lib/sentry/test_helper.rb index 92ecaf85c..5edae4b13 100644 --- a/sentry-ruby/lib/sentry/test_helper.rb +++ b/sentry-ruby/lib/sentry/test_helper.rb @@ -90,9 +90,7 @@ def clear_sentry_events transport.clear if transport.respond_to?(:clear) end - if Sentry.configuration.enable_logs && sentry_logger.respond_to?(:clear) - sentry_logger.clear - end + sentry_logger.clear if sentry_logger.respond_to?(:clear) end # @return [Sentry::StructuredLogger, Sentry::DebugStructuredLogger] diff --git a/sentry-ruby/spec/isolated/sentry_logger_spec.rb b/sentry-ruby/spec/isolated/sentry_logger_spec.rb index 164d451c9..78a92c535 100644 --- a/sentry-ruby/spec/isolated/sentry_logger_spec.rb +++ b/sentry-ruby/spec/isolated/sentry_logger_spec.rb @@ -6,7 +6,6 @@ before do perform_basic_setup do |config| config.breadcrumbs_logger = [:sentry_logger] - config.enable_logs = true config.max_log_events = 1 config.enabled_patches = [:logger] end diff --git a/sentry-ruby/spec/isolated/std_lib_logger_spec.rb b/sentry-ruby/spec/isolated/std_lib_logger_spec.rb index e6a0eb68f..5e43b7537 100644 --- a/sentry-ruby/spec/isolated/std_lib_logger_spec.rb +++ b/sentry-ruby/spec/isolated/std_lib_logger_spec.rb @@ -5,25 +5,9 @@ RSpec.describe Sentry::StdLibLogger do let(:logger) { ::Logger.new($stdout) } - context "when logger patch is enabled but enable_logs is turned off" do - it "logs a warning message" do - string_io = StringIO.new - - perform_basic_setup do |config| - config.enable_logs = false - config.enabled_patches = [:logger] - config.sdk_logger = ::Logger.new(string_io) - end - - expect(string_io.string).to include("WARN -- : :logger patch enabled but `enable_logs` is turned off - skipping applying patch") - end - end - - context "when enable_logs is set to true but logger patch is not enabled" do + context "when logger patch is not enabled" do before do - perform_basic_setup do |config| - config.enable_logs = true - end + perform_basic_setup end it "does not send log using stdlib logger" do @@ -35,11 +19,10 @@ end end - context "when enable_logs is set to true and logger patch is set" do + context "when logger patch is enabled" do before do perform_basic_setup do |config| config.max_log_events = 1 - config.enable_logs = true config.enabled_patches = [:redis, :puma, :http, :logger] end end diff --git a/sentry-ruby/spec/sentry/debug_structured_logger_spec.rb b/sentry-ruby/spec/sentry/debug_structured_logger_spec.rb index df22230d9..dce9b551c 100644 --- a/sentry-ruby/spec/sentry/debug_structured_logger_spec.rb +++ b/sentry-ruby/spec/sentry/debug_structured_logger_spec.rb @@ -3,7 +3,6 @@ RSpec.describe Sentry::DebugStructuredLogger do let(:configuration) do config = Sentry::Configuration.new - config.enable_logs = true config.dsn = Sentry::TestHelper::DUMMY_DSN config end @@ -26,19 +25,6 @@ it "creates a log file" do expect(debug_logger.log_file).to be_a(Pathname) end - - context "when logs are disabled" do - let(:configuration) do - config = Sentry::Configuration.new - config.enable_logs = false - config.dsn = Sentry::TestHelper::DUMMY_DSN - config - end - - it "creates a no-op logger backend" do - expect(debug_logger.backend).to be_a(Sentry::DebugStructuredLogger::NoOpLogger) - end - end end describe "logging methods" do diff --git a/sentry-ruby/spec/sentry/log_event_buffer_spec.rb b/sentry-ruby/spec/sentry/log_event_buffer_spec.rb index 3e1e9d9e5..7e3f8ae75 100644 --- a/sentry-ruby/spec/sentry/log_event_buffer_spec.rb +++ b/sentry-ruby/spec/sentry/log_event_buffer_spec.rb @@ -12,6 +12,5 @@ body: "Test message" ) }, - max_items_config: :max_log_events, - enable_config: :enable_logs + max_items_config: :max_log_events end diff --git a/sentry-ruby/spec/sentry/metric_event_buffer_spec.rb b/sentry-ruby/spec/sentry/metric_event_buffer_spec.rb index c3982c2c4..3052f1ce0 100644 --- a/sentry-ruby/spec/sentry/metric_event_buffer_spec.rb +++ b/sentry-ruby/spec/sentry/metric_event_buffer_spec.rb @@ -13,6 +13,5 @@ value: 1 ) }, - max_items_config: :max_metric_events, - enable_config: :enable_metrics + max_items_config: :max_metric_events end diff --git a/sentry-ruby/spec/sentry/structured_logger_spec.rb b/sentry-ruby/spec/sentry/structured_logger_spec.rb index 2142fc447..94a68801a 100644 --- a/sentry-ruby/spec/sentry/structured_logger_spec.rb +++ b/sentry-ruby/spec/sentry/structured_logger_spec.rb @@ -1,23 +1,10 @@ # frozen_string_literal: true RSpec.describe Sentry::StructuredLogger do - context "when enable_logs is set to false" do - before do - perform_basic_setup do |config| - config.enable_logs = false - end - end - - it "initializes" do - expect(Sentry.logger).to be_a(described_class) - end - end - context "when log events are enabled" do before do perform_basic_setup do |config| config.max_log_events = 1 - config.enable_logs = true end end @@ -220,7 +207,6 @@ before do perform_basic_setup do |config| - config.enable_logs = true config.send_client_reports = send_client_reports config.max_log_events = 1 config.before_send_log = before_send_log diff --git a/sentry-ruby/spec/sentry_spec.rb b/sentry-ruby/spec/sentry_spec.rb index 9c5751cf1..2754f63f1 100644 --- a/sentry-ruby/spec/sentry_spec.rb +++ b/sentry-ruby/spec/sentry_spec.rb @@ -483,7 +483,6 @@ describe ".capture_log" do before do perform_basic_setup do |config| - config.enable_logs = true config.traces_sample_rate = 1.0 config.max_log_events = 1 end diff --git a/sentry-ruby/spec/support/shared_examples_for_telemetry_event_buffers.rb b/sentry-ruby/spec/support/shared_examples_for_telemetry_event_buffers.rb index e26286e16..e966f514b 100644 --- a/sentry-ruby/spec/support/shared_examples_for_telemetry_event_buffers.rb +++ b/sentry-ruby/spec/support/shared_examples_for_telemetry_event_buffers.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.shared_examples "telemetry event buffer" do |event_factory:, max_items_config:, enable_config:| +RSpec.shared_examples "telemetry event buffer" do |event_factory:, max_items_config:| let(:string_io) { StringIO.new } let(:sdk_logger) { ::Logger.new(string_io) } let(:client) { Sentry.get_current_client } @@ -11,7 +11,6 @@ config.sdk_logger = sdk_logger config.background_worker_threads = 0 config.public_send(:"#{max_items_config}=", max_items) - config.public_send(:"#{enable_config}=", true) end Sentry.background_worker = Sentry::BackgroundWorker.new(Sentry.configuration) diff --git a/spec/apps/rails-mini/app.rb b/spec/apps/rails-mini/app.rb index f29c500b6..48f75988d 100644 --- a/spec/apps/rails-mini/app.rb +++ b/spec/apps/rails-mini/app.rb @@ -74,7 +74,6 @@ def debug_log_path config.sdk_debug_transport_log_file = debug_log_path.join("sentry_debug_events.log") config.background_worker_threads = 0 - config.enable_logs = true config.structured_logging.logger_class = Sentry::DebugStructuredLogger config.structured_logging.file_path = debug_log_path.join("sentry_e2e_tests.log") diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 64e314ec4..06a38352a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -49,7 +49,6 @@ config.before(:suite) do Test::Helper.perform_basic_setup do |config| config.transport.transport_class = Sentry::DebugTransport - config.enable_logs = true config.structured_logging.logger_class = Sentry::DebugStructuredLogger config.structured_logging.file_path = Test::Helper.debug_log_path.join("sentry_e2e_tests.log") end