I am running a Rails application on Apache using mod_passenger. I would like Rails.logger
calls to write to the Apache error log rather than to the application's log file in log/producti开发者_如何学运维on.log
.
How can I do this?
In your config/environments/production.rb file you can add something like:
config.logger = Logger.new("/var/log/apache2/error.log")
Of course your app will need to have permissions to such a file. In addition intermixing Apache errors with your apps logs is definitely not a good idea.
This doesn't answer your question directly but I've just run a little test and STDERR.puts "meep"
ended up in Apache's error log while using mod_passenger.
Perhaps then you could point config.logger
at STDERR
?
精彩评论