Archivio mensile:febbraio 2016

Automatic log rotation on Ruby On Rails

On the file:

/config/application.rb

set the current configuration:

# Roteate logs when it is 100MB in size and keep 5.
 config.logger = Logger.new(Rails.root.join('log', "#{Rails.env}.log"), 5, 104857600)

This will automatically create files like

  • development.log.0
  • development.log.1
  • etc…

Based on your environment