Rails Logger

I came across this quick tip on how to reduce the size of your Rails log files. Over time, the development and test log might get bigger and bigger.

A quick solution is to rotate your logs through the Rails Logger:

config.logger = Logger.new(Rails.root.join("log",Rails.env + ".log"), 3, 5*1024*1024)

This will rotate your log files every 5MB and leave the 3 most recent log files.

One downside is when you start your Mongrel or WEBrick server, you won’t get any output anymore in your terminal. So keep that in minder when running in development.