|
Peter Marklund's Home |
Really Simple Rails Log Rotatation
I always used logrotate Linux tool to setup log rotation for my Rails apps which has worked fine although it required finding some external config file and understanding its config options and syntax. I never new log rotation could be set up by adding this one line to config/environments/production.rb right in your app:
config.logger = Logger.new(config.log_path, 50, 1.megabyte)
Sweet!
Comments
Adam Meehan said about 1 year ago:
This is a good tip, but if I remember rightly way back when there was talk of it locking up mongrels if more than one tried to rotate the log at the same time.
Its perfect for development and test however. Thanks for the reminder.
Adam
Ashrafuzzaman said about 1 year ago:
Thanks Peter.
It helped a lot :D




Swami Atma said about 1 year ago:
Nice Peter. Good tip.