Rails Logger似乎正在复制日志行 [英] Rails Logger appears to be duplicating log lines

查看:59
本文介绍了Rails Logger似乎正在复制日志行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Rails记录器感到好奇.

I am experiencing something curious with the rails logger.

当我在代码中插入Rails.logger.info("Some text")时(通常是为了跟踪流程),我在控制台中得到两行"Some text"的输出.

When I insert a Rails.logger.info("Some text") in the code, usually to trace flow, I am getting two lines of "Some text" output in the console.

通常这不是什么大问题,但是当我转储较大对象的内容时,输出可能会很麻烦.

This ordinarily isn't much of a problem, but when I dump the contents of larger objects, the output can get cumbersome to wade through.

在升级到Rails 4之前,这似乎从未发生过,或者至少我不记得发生过这种情况.

This never seemed to happen before I upgraded to Rails 4, or at least, I don't recall it happening.

有人知道这里发生了什么吗?是否有办法停止复制日志输出?

Does anyone know what is happening here, and if there is a way to stop duplicating log output?

推荐答案

尝试将rails_12factor gem(如果已安装)移动到生产组.

Try moving the rails_12factor gem (if you've got it installed) to the production group.

group :production do
  gem 'rails_12factor'
end

这篇关于Rails Logger似乎正在复制日志行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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