diff --git a/Changes.md b/Changes.md index 7e1521b7..00b0fc5b 100644 --- a/Changes.md +++ b/Changes.md @@ -1,3 +1,8 @@ +HEAD +----------- + +- log rotation via USR2 didn't close the old logger [#1008] + 2.12.4 ----------- diff --git a/lib/sidekiq/logging.rb b/lib/sidekiq/logging.rb index 183d5fb3..03739974 100644 --- a/lib/sidekiq/logging.rb +++ b/lib/sidekiq/logging.rb @@ -26,9 +26,11 @@ module Sidekiq end def self.initialize_logger(log_target = STDOUT) + oldlogger = @logger @logger = Logger.new(log_target) @logger.level = Logger::INFO @logger.formatter = Pretty.new + oldlogger.close if oldlogger && !$TESTING # don't want to close testing's STDOUT logging @logger end