日志输出太详细 - 如何更改日志级别?

时间:2014-10-23 01:20:54

标签: ruby-on-rails logging

我试图调试我的简单Rails应用程序并找到使用puts的导航和打印效果很好但是Bash中的日志过于冗长。我在这里看了很多问题/回答并尝试了其中一些但没有成功。我尝试用

导入quiet_assets Gem
gem 'quiet_assets', group: :development

并尝试将日志级别更改为:production.rb中的错误

  config.log_level = Logger::error

但是在导航时难以获得资产的所有GET请求。

值得注意的是,我已尝试重新启动服务器并运行捆绑以防万一。即使浏览器缓存不应该与此有任何关系,我也会进行硬刷新。

以下是导航示例:

20:08:55 web.1  | 127.0.0.1 - - [22/Oct/2014 20:08:55] "GET /application.js HTTP/1.1" 304 - 0.0185
20:08:55 web.1  | 127.0.0.1 - - [22/Oct/2014 20:08:55] "GET /application.css HTTP/1.1" 304 - 0.0790
20:08:56 web.1  | 127.0.0.1 - - [22/Oct/2014 20:08:56] "GET /brands/46 HTTP/1.1" 304 - 0.0111
20:08:56 web.1  | 127.0.0.1 - - [22/Oct/2014 20:08:56] "GET /application.js HTTP/1.1" 304 - 0.0062
20:08:56 web.1  | 127.0.0.1 - - [22/Oct/2014 20:08:56] "GET /application.css HTTP/1.1" 304 - 0.0066
20:08:57 web.1  | 127.0.0.1 - - [22/Oct/2014 20:08:57] "GET /brands/46 HTTP/1.1" 304 - 0.0105
20:08:57 web.1  | 127.0.0.1 - - [22/Oct/2014 20:08:57] "GET /application.js HTTP/1.1" 304 - 0.0056
20:08:57 web.1  | 127.0.0.1 - - [22/Oct/2014 20:08:57] "GET /application.css HTTP/1.1" 304 - 0.0063
20:09:13 web.1  | E, [2014-10-22T20:09:13.695412 #5880] ERROR -- : worker=0 PID:5916 timeout (16s > 15s), killing
20:09:13 web.1  | E, [2014-10-22T20:09:13.704183 #5880] ERROR -- : reaped #<Process::Status: pid 5916 SIGKILL (signal 9)> worker=0
20:09:13 web.1  | I, [2014-10-22T20:09:13.710805 #5923]  INFO -- : worker=0 ready

1 个答案:

答案 0 :(得分:0)

看来你正在看生产日志,对吗?如果是这种情况,quiet_assets也应该包含在生产中。

gem 'quiet_assets'