我应该在 Rails 3.2 的默认生产环境中的 production.log 中看到什么样的信息?
我正在运行 Passenger 并尝试访问虚构的控制器名称和无效参数,但在 production.log 中没有显示任何内容。
我尝试在环境/生产.rb 中将记录器级别设置为调试,但该日志仍然为空。
谢谢
编辑
这里有关于冲洗问题的更多信息:
https://github.com/rails/rails/问题/4277
What kind of information should I expect to see in production.log from a default production environment in rails 3.2?
I'm running Passenger and have tried accessing made up controller names and invalid parameters, but nothing is showing up in production.log.
I tried setting the logger level to debug in environments/production.rb, but that log is still blank.
Thanks
Edit
Here's more info on the flushing issue:
https://github.com/rails/rails/issues/4277
发布评论
评论(2)
似乎是因为日志文件刷新。默认情况下,rails 不会刷新生产环境中的每个写入日志。
这个拉取请求修复了它,并且在rails HEAD中你可以尝试
Seems like it's because of logfile flushing. By default rails not flushing every write to log in production environment.
This pull request fix it, and in rails HEAD you can try
您可能需要通过创建初始值设定项将
Rails.logger
设置为ActiveSupport::Logger
。通过 将其更改为活动支持。
Rails.logger
检查该值,如果它显示编辑:我尝试使用 config.logger 在 Production.rb 中执行相同的操作,但它总是被覆盖。所以我决定采用这种方法。
You might need to set
Rails.logger
toActiveSupport::Logger
by creating an initializer.Check the value by
Rails.logger
if it shows<RailsStdoutLogging::StdoutLogger:
change it to active support.EDIT: I tried doing the same in
production.rb
usingconfig.logger
but it always gets overwritten. So i decided to go with this approach.