config.logger = Logger.new(config.log_path, 3, 10 * 1024**2)
Logfiles can get 10mb big, than they will be renamed to e.g. production.log.0 and if there are more than 3 of them they get deleted.
Maximum filesystem usage: 30mb
An alternative is using logrotate which is a harder to setup and maintain, but offers more options.
4 thoughts on “Logfiles getting big? Rotate them automatically!”
If you use the logging gem at http://logging.rubyforge.com, you can use the RollingFileAppender.
I am pretty satisfied with Rails logging as it is, now that my logfiles size is limited, but ill have a look what the logging gem can do for me 🙂
I believe if you use this approach with mongrel, your mongrels will all try to rotate the file at the same time, causing all but the first mongrel to rotate the log to indefinitely block (lock up).
sounds possible, but so far we did not encounter the problem and i hope the logger developers too care of it since it is an obvious problem.