1

How do I prevent logging a certain route alone in my log files in production environment

Started GET "/bar" for 134.45.310.236 at 2014-00-13 06:36:23 +0000
Processing by FooController#index as HTML
  Rendered text template (0.0ms)
Completed 200 OK in 2.6ms (Views: 0.5ms | ActiveRecord: 0.0ms)
Rpj
  • 5,348
  • 16
  • 62
  • 122

1 Answers1

0

Use Silencer Gem

To use it, create an initializer (like config/initializers/silencer.rb) with the contents:

require 'silencer/rails/logger'

Rails.application.configure do
  config.middleware.swap(
    Rails::Rack::Logger, 
    Silencer::Logger, 
    config.log_tags,
    silence: ["/noisy/action.json"]
  )
end

And just add your routes to the silence array

dcohenb
  • 2,099
  • 1
  • 17
  • 34