Rails:无法访问日志文件
重新启动 Rails 应用程序时出现以下错误。 我以前在另一台服务器上使用另一个应用程序时遇到过这个问题,但不记得问题是什么,也不记得我是如何解决的。
Rails Error: Unable to access log file. Please ensure that /apps/staging/releases/20090310162127/log/staging.log exists and is chmod 0666. The log level has been raised to WARN and the output directed to STDERR until the problem is fixed.
我正在 Ubuntu 上使用 capistrano 部署到混合集群。
当我执行 ls -l /apps/staging/releases/20090310162127/log/staging.log 时,
结果是:
-rw-rw-rw- 1 me grp 51 Mar 10 16:07 /apps/staging/releases/20090310162127/log/staging.log
日志目录是指向 /apps/staging/ 的链接共享/日志。
这是怎么回事?
I get the following error when restarting my rails app. I've had this problem before, on another server with another app, but can't remember what the problem was, or how I solved it.
Rails Error: Unable to access log file. Please ensure that /apps/staging/releases/20090310162127/log/staging.log exists and is chmod 0666. The log level has been raised to WARN and the output directed to STDERR until the problem is fixed.
I'm deploying to a mongrel cluster with capistrano on Ubuntu.
When I do ls -l /apps/staging/releases/20090310162127/log/staging.log
the result is:
-rw-rw-rw- 1 me grp 51 Mar 10 16:07 /apps/staging/releases/20090310162127/log/staging.log
The log dir is a link
to /apps/staging/shared/log.
What's going on?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Rails 是否以
me
身份运行? 如果不是,它以什么用户身份运行? 该用户是否被入狱
了? 用户是否拥有/apps/staging/shared/log
的所有组件以及/apps/staging/releases/20090310162127/log
的所有组件的遍历权限?Is Rails running as
me
? If not, what user is it running as? Is that userjail
'ed? Does the user have traverse permissions for all components of/apps/staging/shared/log
as well as all components of/apps/staging/releases/20090310162127/log
?事实证明这是一个微妙的 Rails 错误:
当这两行中引发异常时,
rails 假设它找不到日志文件。 然而,实际错误发生在第二行:NameError,因为常量不正确。 原因是我的配置文件中有一个旧的日志级别:
Rails 2.2 使用自己的记录器,并且不理解上面的行。
解决办法:去掉线,或者使用:
It turned out to be a subtle rails bug:
When an exception is raised in these two lines
rails assumes it can't find the log file. However, the actual error occurred in the second line: a NameError because the constant is incorrect. The reason is that there was a legacy log level in my configuration file:
Rails 2.2 uses its own logger, and doesn't understand the above line.
Solution: remove line, or use: