每次我加载一个页面,webrick都会污染其日志,其中包含许多资源渲染线.我想要渲染资产,但是我不希望它被记录下来,因为它使得真正重要的事情变得非常困难.如何强制它停止这样做?
有一个
this https://github.com/rails/rails/issues/2639的开放票,当它关闭,你有最后最伟大的,在config / environments / development.rb添加:
原文链接:/javaschema/281447.htmlconfig.assets.logger = nil
在上述问题解决之前,这将会奏效:
Rails.application.assets.logger = Logger.new('/dev/null') Rails::Rack::Logger.class_eval do def before_dispatch_with_quiet_assets(env) before_dispatch_without_quiet_assets(env) unless env['PATH_INFO'].index("/assets/") == 0 end alias_method_chain :before_dispatch,:quiet_assets end
参考:How to disable logging of asset pipeline (sprockets) messages in Rails 3.1?