Feature #4393
closed
Make Logger rotate and split logfiles
Added by Felix Schäfer over 16 years ago.
Updated over 15 years ago.
Description
This issue has already been discussed in #3388 (well, obviously more rejected than discussed), but I will repeat this feature request nonetheless, because Logger#new can do that on its own. This would require only a one-line addition to source:/trunk/config/environments/production.rb, for example:
config.logger = Logger.new(config.log_path, 7, 1048576)
How would this work in a multi process deployment where there are several processes writing to the log file at once?
Well, I just assumed that as Logger is part of stdlib it would take care of it, but I went digging in the ruby core_ext directory, and found logger.rb and monitor.rb. Short version: Logger uses a mutex through MonitorMixin. Long version: take a look at Logger#initialize (line 256) and LogDevice (line 473) in logger.rb and MonitorMixin (basically the whole file) in monitor.rb (lines apply for the OS X.6 version of 1.8.7, don't know how "vanilla" it is).
- Status changed from New to Closed
- Resolution set to Fixed
Also available in: Atom
PDF