1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

Restoring logger compatibility upon logger being set to nil (#5299)

As part of Sidekiq v.4.6.2, the way the log level is set when
Sidekiq's logger is explicitly set to `nil` broke compatibility with
gems like RailsSemanticLogger.

Problematic case:

If a Rails app uses RailsSemanticLogger and sets `Sidekiq.logger = nil`
in an initializer the app would not be able to load due to an undefined
method error. This was caused by the fact that

* RailsSemanticLogger sets Sidekiq's logger to a SemanticLogger instance
* Setting Sidekiq's logger later on would trigger a call to logger.fatal!

SemanticLogger does not implement `fatal!` and this would be the cause
of the error.

This PR fixes the isssue by reverting the way the log level is set.

(fixes #5297)
This commit is contained in:
Simon Courtois 2022-04-26 17:48:07 +02:00 committed by GitHub
parent d12cf87153
commit a89d84509c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -209,7 +209,7 @@ module Sidekiq
def self.logger=(logger)
if logger.nil?
self.logger.fatal!
self.logger.level = Logger::FATAL
return self.logger
end