Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sidekiq Log Level not being set in production

I'm running Sidekiq with Rails 5.2.3 on AWS Elastic Beanstalk. Following the instructions in the Sidekiq wiki in initializers/sidekiq.rb I've set:

Sidekiq.configure_server do |config|
   config.logger.level = Logger::WARN
end 

This works in the development environment however in production Sidekiq is still generating logs at the debug level. The Rails production logger level is set to config.log_level = :warn

like image 855
Andrew Lynch Avatar asked Sep 10 '19 14:09

Andrew Lynch


1 Answers

I had a similar, but opposite problem. My production log level was set to WARN, my Sidekiq log level was set to INFO, but I kept getting only WARN logs in production.

I finally figured out you must manually override the other loggers with Sidekiq.Logging


    Sidekiq.configure_server do |config|
       config.logger.level = Logger::WARN

       Rails.logger = Sidekiq.logger
       ActiveRecord::Base.logger = Sidekiq.logger
       ActiveJob::Base.logger = Sidekiq.logger
    end 

Credit to: https://github.com/mperham/sidekiq/issues/3651

like image 85
vinhboy Avatar answered Nov 20 '22 20:11

vinhboy