(Hope I have the right SE site for this question, apologies if not.)
I have a Ruby-on-Rails application that is deployed using Apache+mod_rails (passenger). It uses MySQL for the database backend. I'm using
SyslogLogger to send the RoR log to syslog and using
logrotate via a daily cron job to rotate the logs.
What I've found is that the RoR app hangs if it is in the middle of something when the logs are rotated. I've tried putting
copytruncate in the
logrotate configuration, but it appears that this also affects the
apache logs (maybe because the RoR error logs go to the
error.log file of
apache) and - possibly - also the MySQL logs (maybe - it's sometimes hard to correlate exactly which log causes the crash).
Searching on the internet turns up some different solutions on log rotation, one is to use the
copytruncate key, another is to use
cronolog, but I've yet to find one that directly addresses the issue I'm seeing.
So is there a known solution for this? What is the "right way" to rotate logs on a RoR application (using apache and mod_rails for deployment)? Should I just put
copytruncate in every logrotate configuration file that is vaguely related with the application?