Ruby on Rails日志文件大小太大 [英] Ruby on rails log file size too large
问题描述
我偶然发现我的rails3.1日志文件非常大,大约21mb. 就尺寸而言,这是正常的吗?生产环境中的日志文件会是什么样? 此外,我可以摆脱日志吗?谢谢
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, can I get rid of the log?thanks
推荐答案
您可以删除文件!
如果不存在,Rails将创建一个新日志.
如果文件很重要,显然可以保存/备份文件,但通常不重要.
如果要将文件保留在同一驱动器上,但仍可以节省空间,则还可以压缩备份的文件(然后删除源文件).
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:
那您就可以设置它,而忘记它了!
then you can set it and forget it!
要实际更改记录的内容,请参见:
To actually change what gets logged see:
http://dennisreimann.de /blog/silencing-the-rails-log-on-per-action-basis/
这篇关于Ruby on Rails日志文件大小太大的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!