From 8b2ff6c951dfbefb869027cfb114ca2e2e7a267a Mon Sep 17 00:00:00 2001 From: Thorsten Ball Date: Tue, 11 Dec 2012 16:04:07 +0100 Subject: [PATCH] Reopen log file after receiving USR2 signal --- lib/sidekiq/cli.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/sidekiq/cli.rb b/lib/sidekiq/cli.rb index 35fec316..989ece57 100644 --- a/lib/sidekiq/cli.rb +++ b/lib/sidekiq/cli.rb @@ -15,6 +15,11 @@ trap 'USR1' do mgr.async.stop if mgr end +trap 'USR2' do + Sidekiq.logger.info "Received USR2, reopening log file" + Sidekiq.logger = Sidekiq::Logging.new_file_logger(Sidekiq.options[:logfile]) +end + trap 'TTIN' do Thread.list.each do |thread| Sidekiq.logger.info "Thread TID-#{thread.object_id.to_s(36)} #{thread['label']}"