How to prevent Rails from Action View logging in production

前端 未结 2 1930
情话喂你
情话喂你 2021-01-03 04:27

In rails 3.2.0,is it possible to turn off rails logging for rendering of views in ActionView:: LogSubscriber in production environment.

Currently only way i found to

相关标签:
2条回答
  • 2021-01-03 04:55

    You can directly turn off action_view logger.

    Rails.application.configure do
      config.action_view.logger = nil
    end
    
    0 讨论(0)
  • 2021-01-03 05:04

    ActionView uses ActiveSupport::Notifications and ActiveSupport::LogSubscriber to instrument its events, and to silence it from the logs is as simple as including the following in your environment file:

    %w{render_template render_partial render_collection}.each do |event|
      ActiveSupport::Notifications.unsubscribe "#{event}.action_view"
    end
    

    Cheers!

    0 讨论(0)
提交回复
热议问题