Is there a way to turn off the following logging in sidekiq?
You can just log to /dev/null or you could write your own logging class and make Sidekiq use it here
Sidekiq.configure_server do |config|
config.logger = nil
end
Or just redirect to /dev/null on the command line.
Thanks a lot.
I tried this
Sidekiq.configure_server do |config|
config.logger = nil
end
and got this error...
0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2012-06-26T06:51:04+00:00 app[clockworker.1]: undefined method `logger=' for Sidekiq:Module
2012-06-26T06:51:04+00:00 app[clockworker.1]: /app/config/initializers/sidekiq.rb:20:in `block in <top (required)>'
2012-06-26T06:51:04+00:00 app[clockworker.1]: /app/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.0.1/lib/sidekiq.rb:43:in `configure_server'
2012-06-26T06:51:04+00:00 app[clockworker.1]: /app/config/initializers/sidekiq.rb:11:in `<top (required)>'
2012-06-26T06:51:04+00:00 app[clockworker.1]: /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:245:in `load'
2012-06-26T06:51:04+00:00 app[clockworker.1]: /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:245:in `block in load'
2012-06-26T06:51:04+00:00 app[clockworker.1]: /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:236:in `load_dependency'
2012-06-26T06:51:04+00:00 app[clockworker.1]: /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:245:in `load'
2012-06-26T06:51:04+00:00 app[clockworker.1]: /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/engine.rb:588:in `block (2 levels) in <class:Engine>'
2012-06-26T06:51:04+00:00 app[clockworker.1]: /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/engine.rb:587:in `each'
2012-06-26T06:51:04+00:00 app[clockworker.1]: /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/engine.rb:587:in `block in <class:Engine>'
2012-06-26T06:51:04+00:00 app[clockworker.1]: /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/initializable.rb:30:in `instance_exec'
2012-06-26T06:51:04+00:00 app[clockworker.1]: /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/initializable.rb:30:in `run'
2012-06-26T06:51:04+00:00 app[clockworker.1]: /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/initializable.rb:55:in `block in run_initializers'
2012-06-26T06:51:04+00:00 app[clockworker.1]: /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/initializable.rb:54:in `each'
2012-06-26T06:51:04+00:00 app[clockworker.1]: /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/initializable.rb:54:in `run_initializers'
2012-06-26T06:51:04+00:00 app[clockworker.1]: /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/application.rb:136:in `initialize!'
2012-06-26T06:51:04+00:00 app[clockworker.1]: /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/railtie/configurable.rb:30:in `method_missing'
2012-06-26T06:51:04+00:00 app[clockworker.1]: /app/config/environment.rb:5:in `<top (required)>'
2012-06-26T06:51:04+00:00 app[clockworker.1]: /app/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.0.1/lib/sidekiq/cli.rb:116:in `require'
2012-06-26T06:51:04+00:00 app[clockworker.1]: /app/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.0.1/lib/sidekiq/cli.rb:116:in `boot_system'
2012-06-26T06:51:04+00:00 app[clockworker.1]: /app/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.0.1/lib/sidekiq/cli.rb:63:in `parse'
2012-06-26T06:51:04+00:00 app[clockworker.1]: /app/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.0.1/bin/sidekiq:7:in `<top (required)>'
2012-06-26T06:51:04+00:00 app[clockworker.1]: /app/vendor/bundle/ruby/1.9.1/bin/sidekiq:23:in `load'
2012-06-26T06:51:04+00:00 app[clockworker.1]: /app/vendor/bundle/ruby/1.9.1/bin/sidekiq:23:in `<main>'
I added this Sidekiq::Logging.logger = nil to the initializer file and that worked.
Oops, we need Sidekiq.logger=
So Sidekiq.logger= inside the configure_server block? Right now I have Sidekiq::Logging.logger = nil outside the block, is that invalid?
Yes, that will work, it's just considered an undocumented internal API. The code block I gave will be the "right" way to do it.
Most helpful comment
Or just redirect to /dev/null on the command line.