lib/logjam_agent/railtie.rb in logjam_agent-0.38.5 vs lib/logjam_agent/railtie.rb in logjam_agent-0.39.0
- old
+ new
@@ -31,9 +31,22 @@
"Logging Error: Unable to access log file. Please ensure that #{path} exists and is writable. " +
"The log level has been raised to WARN and the output directed to STDERR until the problem is fixed."
)
LogjamAgent.logger = logger
end
+
+ if Gem::Version.new(Rails::VERSION::STRING) >= Gem::Version.new("7.1.0")
+ unless Rails.logger.is_a?(ActiveSupport::BroadcastLogger)
+ broadcast_logger = ActiveSupport::BroadcastLogger.new(Rails.logger)
+ broadcast_logger.formatter = Rails.logger.formatter
+ Rails.logger = broadcast_logger
+ LogjamAgent.logger = logger
+ end
+
+ unless app.config.consider_all_requests_local
+ Rails.error.logger = Rails.logger
+ end
+ end
end
initializer "logjam_agent", :after => "time_bandits" do |app|
LogjamAgent.environment_name = ENV['LOGJAM_ENV'] || Rails.env
LogjamAgent.auto_detect_logged_exceptions