languages / ruby / configuration / logrageify-silence-noisy-logs

Ruby Configuration - Logrageify. Silence Noisy Logs.

Timber allows you to silence noisy logs that aren't of value to you, just like lograge. As such, we've provided a convenience configuration option for anyone transitioning from lograge.

How to use it

1
2
3
# config/initializers/timber.rb

Timber.config.logrageify!()

How it works

It turns this:

Started GET "/" for 127.0.0.1 at 2012-03-10 14:28:14 +0100
Processing by HomeController#index as HTML
  Rendered text template within layouts/application (0.0ms)
  Rendered layouts/_assets.html.erb (2.0ms)
  Rendered layouts/_top.html.erb (2.6ms)
  Rendered layouts/_about.html.erb (0.3ms)
  Rendered layouts/_google_analytics.html.erb (0.4ms)
Completed 200 OK in 79ms (Views: 78.8ms | ActiveRecord: 0.0ms)

Into this:

Get "/" sent 200 OK in 79ms

Internally this is equivalent to:

1
2
3
4
5
6
# config/initializers/timber.rb

Timber.config.integrations.action_controller.silence = true
Timber.config.integrations.action_view.silence = true
Timber.config.integrations.active_record.silence = true
Timber.config.integrations.rack.http_events.collapse_into_single_event = true

Feel free to deviate and customize which logs you silence.

Pro-tip: Keep controller call logs (recommended)

Keeping your controller logs can be very helpful as they include the request parameters. This helps to reproduce and debug issues when they arise.

1
2
3
4
5
# config/initializers/timber.rb

Timber.config.integrations.action_view.silence = true
Timber.config.integrations.active_record.silence = true
Timber.config.integrations.rack.http_events.collapse_into_single_event = true

This does not silence the controller call log event. This is because Timber captures the parameters passed to the controller, which are generally valuable when debugging.

For a full list of integration settings, see Timber::Config::Integrations

Questions?

Chat with us, just click the talk button in the bottom right of this page.

Chat with us
Sign Up

Log better and solve problems faster, today. Install in under a minute.

Sign Up