How to change Rails 3.0's default log path?

前端 未结 3 1516
你的背包
你的背包 2021-02-14 01:03

I have to change my rail application\'s default log path because of my company\'s internal software deployment process: basically my rails app ends up on a read-only location, a

3条回答
  •  不思量自难忘°
    2021-02-14 01:39

    As of Rails 3.2.3, looks like the log pathname is also defined in Rails::Rack::LogTailer#initialize, and that comes from Rails::Server#log_path.

    LOG_PATH = "log/mylog.log"
    
    require 'rails/commands/server'
    module Rails
      class Server
        def log_path
          LOG_PATH
        end
      end
    end
    
    class Application < Rails::Application
      ...
      config.paths['log'] = LOG_PATH
      ...
    end
    

提交回复
热议问题