Rails: Unable to access log file

后端 未结 2 1590
既然无缘
既然无缘 2020-12-08 22:42

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

相关标签:
2条回答
  • 2020-12-08 23:05

    It turned out to be a subtle rails bug:

    When an exception is raised in these two lines

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

    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:

    config.log_level = Logger::INFO
    

    Rails 2.2 uses its own logger, and doesn't understand the above line.

    Solution: remove line, or use:

    config.log_level = :info
    
    0 讨论(0)
  • 2020-12-08 23:24

    Is Rails running as me? If not, what user is it running as? Is that user jail'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?

    0 讨论(0)
提交回复
热议问题