Heroku日志记录不起作用 [英] Heroku logging not working

查看:106
本文介绍了Heroku日志记录不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Heroku Cedar上部署了一个rails 3.1应用程序。我在记录方面遇到问题。默认的rails日志工作正常,但是当我做这样的事情时:

  logger.info记录此消息

在我的控制器中,Heroku不记录任何东西。当我部署我的应用程序时,我看到了heroku消息注入rails_log_stdout,所以我认为调用记录器应该工作得很好。将声明放在我的日志中。我也尝试了其他日志级别,如logger.error。什么都没有有没有其他人看过这个?

解决方案

我只是遇到了同样的问题,通过使用这里的技术解决了问题:



https://github.com/ryanb/cancan/issues/511



基本上,您需要指定记录器输出到STDOUT,一些宝石会干扰记录器,并且似乎劫持了功能(在我的情况下可以扫描)。 p>

对于点击懒惰,只需将它放在environments / production.rb中即可。

  config.logger = Logger.new(STDOUT)
config.log_level =:info


I've got a rails 3.1 app deployed on Heroku Cedar. I'm having a problem with the logging. The default rails logs are working just fine, but when I do something like:

logger.info "log this message"

In my controller, Heroku doesn't log anything. When I deploy my app I see the heroku message "Injecting rails_log_stdout" so I think calling the logger should work just fine. Puts statements end up in my logs. I've also tried other log levels like logger.error. Nothing works. Has anyone else seen this?

解决方案

I was just having the same issue, solved by using the technique here:

https://github.com/ryanb/cancan/issues/511

Basically, you need to specify the logger outputs to STDOUT, some gems interfere with the logger and seem to hijack the functionality (cancan in my case).

For the click lazy, just put this in environments/production.rb

config.logger = Logger.new(STDOUT) 
config.log_level = :info

这篇关于Heroku日志记录不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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