如何清理我的rails日志,以便它们不会显示有关所获取的每个单独资产的所有信息(特别是在开发中)以及所有内容需要多长时间?我在导轨4.2上使用puma。
source=rack-timeout id=7b3b3f3cd8d64909db09 timeout=13000ms service=2ms state=active
Started GET "/assets_dev/logo.png" for 127.0.0.1 at 2015-08-14 09:29:29 -0400
source=rack-timeout id=7b3b3f3cd8d64909db09 timeout=13000ms service=35ms state=completed
source=rack-timeout id=bef678d34175fcacf2b6dd timeout=13000ms state=ready
source=rack-timeout id=bef678d34175fcacf2b6dd17 timeout=1300ms service=1ms state=active
Started GET "/assets_dev/fontawesome-webfont.woff?v=4.0.0" for 127.0.0.1 at 2015-08-14 09:29:29 -0400
source=rack-timeout id=bef678d34175fcacf2b6dd17 timeout=13000ms service=79ms state=completed
source=rack-timeout id=b60818b0635ab2765de8ab4c timeout=13000ms state=ready
source=rack-timeout id=b60818b0635ab2765de8ab4c timeout=13000ms service=1ms state=active
Started GET "/assets_dev/logo2.png" for 127.0.0.1 at 2015-08-14 09:29:29 -0400
source=rack-timeout id=b60818b0635ab2765de8ab4cb8928b40 timeout=13000ms service=80ms state=completed
source=rack-timeout id=b2839d080e992a9974d1984da0b1afcb timeout=13000ms state=ready
答案 0 :(得分:2)
gem quiet_assets在开发日志中平息所有资产噪音。要删除美洲狮时间信息,可以输入Rack::Timeout::Logger.disable
。虽然在出现错误时有时间信息会很有用,所以不确定在生产中是否有意义。
答案 1 :(得分:0)
我假设你的意思是缩小范围。
可用的日志级别为::debug
,:info
,:warn
,:error
,:fatal
和:unknown
您可以通过指定来更改默认值:
config.log_level = :warn # In any environment initializer, or
Rails.logger.level = 0 # at any time
更多信息here