[Mongrel] Log rotation
david at vrensk.com
Sun Oct 1 14:56:31 EDT 2006
I'm just wondering what fellow railsers use to rotate their logs in an
orderly fashion? I'd like to do something lightweight, i.e. (1) rename the
logfile (2, optional) create a new empty logfile and (3) send a signal to
each mongrel in the cluster and have them understand it's time to reopen
their log file handles. This is what I do with apache and nginx and loads
of other apps.
Although the question is simple as stated, let me elaborate a little to
avoid having the discussion going the wrong way (rein it in, as it were):
1. I'm really only concerned about production.log, since that is the big
file. A solution that lets me rotate mongrel.log too is fine, but not
2. I know I can send a SIGUSR2 to each mongrel (or do a mongrel_cluster
restart) to restart mongrel, but I'm running on a low-end machine which
takes no less than 30 seconds to start rails, so I'd rather avoid the
overhead. And even if it didn't, I think most of us agree that there's no
real point in stopping out app even for a second just to reopen a file
3. I realise that mongrel isn't rails-bound, so it might not be mongrel's
responsibility to make rails switch log files. In that case, please point
me in another direction and I'll see what I find.
4. I see that I can send a SIGHUP to mongrel which might make it do the
right thing, but the caveat "(Internal reload) that might not work so well."
is all but encouraging.
Seeing as I've come this far, perhaps I should take a step back and ask:
what do fellow mongrel_railsers use for logging? Logger? Log4R? Something
else entirely? And what made you decide on the solution you use?
Hope you haven't choked on my ramblings, and I look forward to your
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Mongrel-users