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

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

问题描述

我在 Heroku Cedar 上部署了一个 rails 3.1 应用程序.我的日志记录有问题.默认的 Rails 日志工作正常,但是当我执行以下操作时:

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"

在我的控制器中,Heroku 不记录任何内容.当我部署我的应用程序时,我看到了 Heroku 消息Injecting rails_log_stdout",所以我认为调用记录器应该可以正常工作.Puts 语句最终会出现在我的日志中.我还尝试了其他日志级别,如 logger.error.没有任何作用.有没有其他人看到这个?

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

基本上,您需要将记录器输出指定为 STDOUT,一些 gem 会干扰记录器并且似乎劫持了功能(在我的情况下可以).

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).

对于点击懒惰,只需将其放在environments/production.rb

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

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

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

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