Ruby on Rails日志文件大小太大 [英] Ruby on rails log file size too large

查看:70
本文介绍了Ruby on Rails日志文件大小太大的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我偶然发现我的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:

Ruby on Rails生产日志轮换

那您就可以设置它,而忘记它了!

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆