From 4edfdf1dd26aa2b08942bd01cb570919839a9785 Mon Sep 17 00:00:00 2001 From: Petr Heinz Date: Wed, 22 Nov 2023 00:03:59 +0100 Subject: [PATCH] Avoid invoking ActiveSupport::BroadcastLogger if not defined (#2169) * Avoid instantiating BroadcastLogger if not defined * Update CHANGELOG.md * Update CHANGELOG.md --------- Co-authored-by: Stan Lo --- CHANGELOG.md | 1 + sentry-rails/lib/sentry/rails/configuration.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad4f615ec..6b2d8eac6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ ### Bug Fixes - Fixed a deprecation in `sidekiq-ruby` error handler [#2160](https://github.com/getsentry/sentry-ruby/pull/2160) +- Avoid invoking ActiveSupport::BroadcastLogger if not defined [#2169](https://github.com/getsentry/sentry-ruby/pull/2169) ## 5.13.0 diff --git a/sentry-rails/lib/sentry/rails/configuration.rb b/sentry-rails/lib/sentry/rails/configuration.rb index 29eea220a..acfacf69e 100644 --- a/sentry-rails/lib/sentry/rails/configuration.rb +++ b/sentry-rails/lib/sentry/rails/configuration.rb @@ -12,7 +12,7 @@ class Configuration @excluded_exceptions = @excluded_exceptions.concat(Sentry::Rails::IGNORE_DEFAULT) if ::Rails.logger - if ::Rails.logger.respond_to?(:broadcasts) + if defined?(::ActiveSupport::BroadcastLogger) && ::Rails.logger.is_a?(::ActiveSupport::BroadcastLogger) dupped_broadcasts = ::Rails.logger.broadcasts.map(&:dup) @logger = ::ActiveSupport::BroadcastLogger.new(*dupped_broadcasts) else