herokuruby-on-rails-3.1cedar

Heroku logging not working


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?


Solution

  • 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