Dominic Simm
9Nov/130

Limit the size of Rails 3 log files

Log files can get really huge. Luckily, it's easy to automatically rotate your log files in dev/test for a Rails 3 app (>=3.1.1). Add to your .gitignore:

log/*.log.*

And to your config/development.rb and config/test.rb:

# auto rotate log files, keep 2 of 5MB each
require 'active_support/core_ext/numeric/bytes'
config.logger = Logger.new(config.paths['log'].first, 1, 5.megabytes)

You can adjust the number of logs and size according to your needs, but this is a good start. If you get an error because of the 5.megabytes, just put "5242880" instead.

hat dir dieser Artikel gefallen?

Dann abonniere doch diesen Blog per RSS Feed!

Kommentare (0) Trackbacks (0)

Zu diesem Artikel wurden noch keine Kommentare geschrieben.


Leave a comment

Noch keine Trackbacks.