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
You just need define your logger
config.logger = ActiveSupport::BufferedLogger.new(File.join(ENV['SOME_ENVIRONMENT_VAR'], "var/output/logs/rails.log"))
This trick works with Rails 2 too. And you can define by environment where you really want your log file.
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
The config.log_path
setting has been deprecated - the recommended solution is now:
config.paths.log = "/some/path/#{Rails.env}.log"