Rails:如何更改记录器文件名? [英] Rails: How to change the logger filename?

查看:45
本文介绍了Rails:如何更改记录器文件名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想更改记录器的文件名.例如,在生产环境中,默认值为 production.log .

I'd like to change the logger filename. The default, say, on production, is production.log.

例如,我希望将其定制为 production.mymachine.log .

I'd like it be customized, for example, to production.mymachine.log.

我该怎么做?我找不到任何明显的方法.

How can I do this? I can't find any obvious way.

推荐答案

您可以在 config/application.rb 或在 config/环境

# e.g. in config/environments/development.rb
config.logger = Logger.new(Rails.root.join('log', 'development.my_machine.log'))

这篇关于Rails:如何更改记录器文件名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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