生产中的工作日志
现在有人知道为什么我在 workling.output 或 production.log 中看不到工作日志吗?
在开发过程中,日志显示在development.log 中。
在我的环境/生产.rb 中,我将日志级别设置为调试。 config.log_level = :debug
我正在像这样启动 Starling 和 Workling
server > /usr/bin/starling -d -P /tmp/pids/starling.pid -L /mnt/app/current/log/starling.log -p 15151
local > cap deploy:restart
server > RAILS_ENV=production /mnt/app/current/script/workling_client start
Anyone now why I can't see logs for workling in workling.output or production.log?
In development the logs show up in the development.log.
In my environments/production.rb I have the log levl set to debug.
config.log_level = :debug
I'm starting Starling and Workling like this
server > /usr/bin/starling -d -P /tmp/pids/starling.pid -L /mnt/app/current/log/starling.log -p 15151
local > cap deploy:restart
server > RAILS_ENV=production /mnt/app/current/script/workling_client start
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
日志级别不同。开发模式的默认级别是logger.debug,这基本上显示了所有内容。在生产中,我认为它是 logger.info,这只是调用的操作、所用时间和错误。
The log level is different. The Default level for development mode is logger.debug, this shows basically everything. In production I think it's logger.info, this is the actions called, time taken and errors only.
如果其他一切正常,我的猜测是这是一个权限问题,脚本没有足够的权限来写出生产日志。
If everything else is working ok, my guess would be that it's a permissions issue where the scripts don't have sufficient rights to write out the production log.
实际上,问题来自于系统正在执行的缓冲。日志不会立即刷新到 production.log。
您需要刷新记录器才能让您的日志立即出现在 production.log 中:
logger.info“这里有一些信息”
logger.flush
我希望它有帮助。
Actually the problem comes from the buffering that is being done by the system. The logs are not flushed right away to production.log.
You need to flush the logger to get your logs appear right away in production.log:
logger.info "Something informative here"
logger.flush
I hope it helps.