【发布时间】:2012-11-14 07:48:43
【问题描述】:
我的 Rails 开发日志中有大量此类行:
Started GET "/assets/services.css?body=1" for 127.0.0.1 at 2012-11-26 02:27:49 -0800
Served asset /services.css - 304 Not Modified (0ms)
[2012-11-26 02:27:49] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
我想我需要弄清楚如何让 rails 确定内容长度或在某处设置 response.chunked(不确定那到底是什么)以避免最后一行。但是,绝大多数时间我不得不浪费时间搜索这些来找到这样的数据库请求:
Started GET "/points" for 127.0.0.1 at 2012-11-26 02:27:54 -0800
Processing by PointsController#index as HTML
User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
PointsLog Load (0.1ms) SELECT "points_logs".* FROM "points_logs" WHERE "points_logs"."user_id" = 1
Rendered points/index.html.erb within layouts/application (5.4ms)
Completed 200 OK in 43ms (Views: 40.0ms | ActiveRecord: 0.8ms)
我可以查看这些类型的请求的单独日志吗?有没有办法暂时,甚至永久地抑制以“服务资产”开头的日志条目?或者只是不记录服务资产?
【问题讨论】:
标签: ruby-on-rails ruby-on-rails-3 logging ruby-on-rails-3.2 development-environment