ruby-on-rails - rails : Unable to access log file

标签 ruby-on-rails linux capistrano mongrel

重新启动 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 部署到一个 mongrel 集群。

当我执行 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/shared/log 的链接

这是怎么回事?

最佳答案

事实证明这是一个微妙的 Rails 错误:

当这两行抛出异常时

logger = ActiveSupport::BufferedLogger.new(configuration.log_path)
logger.level = ActiveSupport::BufferedLogger.const_get(configuration.log_level.to_s.upcase)

rails 假设它找不到日志文件。然而,真正的错误发生在第二行:一个 NameError 因为常量不正确。原因是我的配置文件中有一个旧的日志级别:

config.log_level = Logger::INFO

Rails 2.2 使用自己的记录器,不理解上面的行。

解决方案:删除行,或者使用:

config.log_level = :info

关于ruby-on-rails - rails : Unable to access log file,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/632592/

相关文章:

javascript - 计时器倒计时到期时提交表单

ruby-on-rails - 使用 `where` 语句查找关联计数的最佳语法是什么

linux - 用于替换两个分隔符位置之间的任何内容的 unix 命令

ruby-on-rails - 为什么在生产中获取空的 CSS 文件?

ruby-on-rails - Sendgrid 在本地接收邮件

c++ - Linux 中的段错误,在 Mac OS 上工作正常

linux - Bash 中没有这样的文件或目录?

capistrano - 部署期间出现 Capifony 错误(OpenSSL::PKey::PKeyError:不是公钥 "/var/www/.ssh/id_rsa.pub")

ruby - Capistrano 3 "upload"任务引发错误

ruby-on-rails - Rails路线奇怪