Rails 3.2杂乱的日志



我在本地服务器上发出的每个请求都会生成大量的日志消息,如下所示:

[aa6f821b342dc08800f423e86d24db20] [127.0.0.1]   Rendered shared/_footer.html.erb (3.5ms)
[aa6f821b342dc08800f423e86d24db20] [127.0.0.1] Completed 200 OK in 2684ms (Views: 590.0ms | ActiveRecord: 191.8ms)
[cd2037fee6bd082a4119d8799a7e7439] [127.0.0.1] 
[cd2037fee6bd082a4119d8799a7e7439] [127.0.0.1] 
[cd2037fee6bd082a4119d8799a7e7439] [127.0.0.1] Started GET "/assets/global.css?body=1" for 127.0.0.1 at 2013-01-18 19:39:22 -0500
[cd2037fee6bd082a4119d8799a7e7439] [127.0.0.1] Served asset /global.css - 304 Not Modified (3ms)
[5f2da9e4e857fb4e8c024a95a424fc14] [127.0.0.1] 
[5f2da9e4e857fb4e8c024a95a424fc14] [127.0.0.1] 
[5f2da9e4e857fb4e8c024a95a424fc14] [127.0.0.1] Started GET "/assets/caEntry.css?body=1" for 127.0.0.1 at 2013-01-18 19:39:22 -0500
[5f2da9e4e857fb4e8c024a95a424fc14] [127.0.0.1] Served asset /caEntry.css - 304 Not Modified (2ms)
[708c81464666f10e1b2a46e1dbf4af71] [127.0.0.1] 
[708c81464666f10e1b2a46e1dbf4af71] [127.0.0.1] 
[708c81464666f10e1b2a46e1dbf4af71] [127.0.0.1] Started GET "/assets/forms.css?body=1" for 127.0.0.1 at 2013-01-18 19:39:22 -0500
[708c81464666f10e1b2a46e1dbf4af71] [127.0.0.1] Served asset /forms.css - 304 Not Modified (2ms)
[3a807660584a753319c6c19c405b9cce] [127.0.0.1] 
[3a807660584a753319c6c19c405b9cce] [127.0.0.1] 

I 确实想知道正在加载什么,但是有没有一种方法可以稍微清理这些空消息?

有一颗宝石,但我不记得名字了…把它放到config/initializers/quiet_assets.rb

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

相关内容

  • 没有找到相关文章

最新更新