Ruby on rails log file size too large

前端 未结 9 1344
无人共我
无人共我 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:29

    you can just delete the file!
    Rails will create a new log if one doesn't exist.
    Obviously save / backup the file if it's important, but usually it's not.
    You can also zip the backuped up file (and then delete the source) if you want to keep it on the same drive but still save space.

    To automatically rotate log files (the best long-term solution) use log rotate as described here:

    Ruby on Rails production log rotation

    then you can set it and forget it!

    To actually change what gets logged see:

    http://dennisreimann.de/blog/silencing-the-rails-log-on-a-per-action-basis/

提交回复
热议问题