For a Rails 3.1 (will be 3.2 very soon), I have exceptionally verbose logs that have a lot of additional worker information spewing forth into them.
I routinely end up with multigigabyte development.log files. I’ve seen some various chatter around about rotating production logs, however I’ve not found anything that seems applicable to development.log rotation.
How do you rotate your development.log at every 100.megabytes or so? OR WHAT I WOULD PREFER is to actually truncate the head of the file so that only the most recent items remain in the log, up to 100MB of the most recent entries.
I have played with this a little and am thinking more and more than nothing quite like this exists at present and that perhaps I should implement something that will use the ruby File.truncate somehow, however I’m not sure of the efficacy of this yet on the tail end of the file as of yet.
You can actually tell the Ruby Logger class to rotate the files in the constructor:
http://corelib.rubyonrails.org/classes/Logger.html#M000163
Example:
In one of my enrivornment files I have the following line:
This keeps the last 10 logfiles which are rotated every 1 MB.