Sidekiq by default logs at info
level and do not respect the rails
log level. This can be problematic in environments where you are running rails
at warn
or error
. Log stream will be flooded by log entries from sidekiq
.
To control sidekiq
and rails
logging level using a single environment variable, add this to your config/initializers/sidekiq.rb
file.
Sidekiq.configure_server do |config|
config.logger.level = Logger.const_get(ENV.fetch('LOG_LEVEL', 'info').upcase.to_s)
end
LOG_LEVEL
variable is used to set the rails log level in config/environments/production.rb
.
config.log_level = ENV.fetch('LOG_LEVEL', 'info').to_sym