Ruby on rails log file size too large

前端 未结 9 1332
无人共我
无人共我 2021-02-01 16:01

I stumbled to learn that my rails3.1 log file is super large, around 21mb. Is this, in terms of size normal? What the log file would like in the production environment? Besides,

9条回答
  •  醉梦人生
    2021-02-01 16:17

    According to the documentation, if you want to limit the size of the log folder, put this in your 'development.rb'-file:

    config.logger = ActiveSupport::Logger.new(config.paths['log'].first, 1, 50 * 1024 * 1024)
    

    With this, your log files will never grow bigger than 50Mb. You can change the size to your own preference. The ‘1’ in the second parameter means that 1 historic log file will be kept, so you’ll have up to 100Mb of logs – the current log and the previous chunk of 50Mb.

提交回复
热议问题