重新启动我的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
日志目录是link
/ apps/staging/shared/log.
这是怎么回事?
事实证明这是一个微妙的铁轨错误:
当在这两行中引发异常时
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