Who said size is not important?

Liquid error: undefined method `login' for nil:NilClass : December 14th, 2005

If you want to make sure your logs won't fill up the /var partition, you should rotate your logs on _size_ instead of _time_. Add this to the Rails::Initializer.run block in environment.rb to keep 50 old logfiles of 1MB each: config.logger = Logger.new("#{RAILS_ROOT}/log/#{ENV['RAILS_ENV']}.log", 50, 1048576)

3 Responses to “Who said size is not important?”

  1. Chris Says:
    Thanks for the tip! 1.megabyte instead of 1048576 is nicer :)
  2. rick Says:
    except active support isn't loaded yet, so you get "undefined method `megabyte' for 1:Fixnum (NoMethodError)" or something...
  3. Tom Fakes Says:
    Even better is to use *config.log_path* to get the configured or default log file name.
    
    config.logger = Logger.new(config.log_path, 50, 1048576)
    

Leave a Reply

I am a human (check this)

Remember: escape your underscores \_ and indent code at least 4 spaces or incur the wrath of smartypants.