How to prevent Rails from Action View logging in production

前端 未结 2 1964
情话喂你
情话喂你 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 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!

提交回复
热议问题