yuexingfu
unread,Aug 27, 2007, 8:32:08 PM8/27/07Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rails4scm
Log文件快速增长会占用大量的服务器空间,文件一般保存在rails的app/log/目录下。
Rails可以通过选择不同的log lever来控制log文件的输出,可以使用的log lever
有:debug, :info, :warn, :error, :fatal.
:debug level提供最详细的log, 可以将每一条sql都记录下来。
:info level是production环境下的默认设置,不会写出sql的执行情况,但也会很详细,如果是ActiveMailer,它会记录
下每封信的内容,Log文件内容就是快速增长。为了避免Log把空间塞满的情况发生,要注意定期清除Log,另外是选择:warn
level等log level, 只记录重要的信息.
设置方法:
在/config/environment.rb文件中可以设置以下选项
config.log_level = :debug #实际上只是把这行的注释取消就可以了
如果只希望在production环境下,输入少量的log,
则只需要在config/environments/production.rb中增加一项(我就是这样设置的)
config.log_level = :warn