Rails 3 未将 500 状态写入日志
我正在使用 nginx 和 Passenger 运行 Rails 3.0.7 应用程序。我有一个自定义 500 页面,当应用程序遇到 500 内部错误时,该页面会正确显示,但实际的“500”状态不会输出到日志中。
我希望能够定期 grep 日志以查找 500 个错误,但我似乎无法弄清楚为什么未呈现实际状态。我什至查看了 Rails 代码,一切看起来都很好。所有其他状态代码均已成功记录。
这是一个无错误的 200 响应:
Completed 200 OK in 1265ms (Views: 1262.4ms | ActiveRecord: 69.6ms | Sphinx: 0.0ms)
这是一个 500 响应:
Completed in 500ms
似乎有些东西应该在那里,但实际上并不在那里,因此改为输出空格。
I'm running a Rails 3.0.7 app with nginx and Passenger. I have a custom 500 page that is properly displayed when the app encounters an 500 internal error, however the actual '500' status is not being output to the logs.
I'd like to be able to periodically grep the logs to find 500 errors, but I can't seem to figure out why the actual status is not being rendered. I've even looked through the Rails code, and everything looks fine. All other status codes are successfully logged.
Here is an error-free 200 response:
Completed 200 OK in 1265ms (Views: 1262.4ms | ActiveRecord: 69.6ms | Sphinx: 0.0ms)
Here is a 500 response:
Completed in 500ms
It appears that something is supposed to be there, but is not, so spaces are output instead.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来这个问题已经在 Rails master 中解决了,但在 3.0.7 的 gem 中还没有解决。
https://github.com/rails/rails/commit/7927fc2ff77543a0ab151ac1cb3d60318e2dfa68
Looks like this has been resolved in Rails master, but is not in the gem for 3.0.7 yet.
https://github.com/rails/rails/commit/7927fc2ff77543a0ab151ac1cb3d60318e2dfa68