Topic: Rolling over log files

Hi Folks,

I was wondering if anyone could let me know how to automatically rollover log files in manageable sizes?

I'm not ready to reduce the amount of logging I'm doing with my app, but trying to debug a 30mb text file is a pain in the butt!!

I've seen people talk about Cron jobs, and have read the section in Agile Web dev with rails about setting it up to copy, but wondered if there is a non-cron based solution.

Cheers

Re: Rolling over log files

I think Logger has this built in, you just need to set it up. IIRC it's something like this:

# in environments/production.rb or any other environment file
config.logger = Logger.new(config.log_path, 7, 100000)

See the docs for details.

Railscasts - Free Ruby on Rails Screencasts