Log files
Your rails application will quickly accumualate large log files once in production. Unfortunately rails cannot handle the rotation of these logs for you.
However, on linux at least, there is an easy solution – logrotate can take care of rotating your log files.
/etc/logrotate.conf, if not just locate logrotate)
# Rails logs:
/path/to/your/app/log/*.log {
daily
missingok
rotate 14
compress
delaycompress
notifempty
create 0666 www-data www-data
}
This will rotate 14 days worth of logs, compressing the older logfiles, and creating a new blank log writable by the web server.
This is not correct, you can get Rails to rotate the logs for you. Put this in your environment.rb:
config.logger = Logger.new("#{RAILS_ROOT}/log/#{RAILS_ENV}.log", 50, 1.megabyte)
great, that looks like a much better solution, but does this cause any issues when running multiple rails processes?. This is why I was told to use logrotate & wrote it up here. If not feel free to remove the logrotate info
Log files
Your rails application will quickly accumualate large log files once in production. Unfortunately rails cannot handle the rotation of these logs for you.
However, on linux at least, there is an easy solution – logrotate can take care of rotating your log files.
/etc/logrotate.conf, if not just locate logrotate)
# Rails logs:
/path/to/your/app/log/*.log {
daily
missingok
rotate 14
compress
delaycompress
notifempty
create 0666 www-data www-data
}
This will rotate 14 days worth of logs, compressing the older logfiles, and creating a new blank log writable by the web server.
This is not correct, you can get Rails to rotate the logs for you. Put this in your environment.rb:
config.logger = Logger.new("#{RAILS_ROOT}/log/#{RAILS_ENV}.log", 50, 1.megabyte)
great, that looks like a much better solution, but does this cause any issues when running multiple rails processes?. This is why I was told to use logrotate & wrote it up here. If not feel free to remove the logrotate info