Recently we where experiencing some weird issues with a Rails 3.2 app that we are hosting on Heroku Cedar and thought it would be good to enable debug logging in the staging environment. I tried to set the log level to DEBUG using the instructions on Heroku Dev Center, but no debug messages showed up in the logs.

I ended up checking out the code for the Rails plugin (rails_log_stdout) that Heroku installs into your app during deployment for setting up logging. It basically just sets Rails.logger to standard output and uses a environment variable called LOG_LEVEL to set the log level. I tried a few different things and ended up copying the line that sets logger to STDOUT from the plugin to our applications config for the staging environment and that did the trick. After that was deployed our debug messages started showing up in the logs. Happy times.

Our config/environments/staging.rb looks something like this now:

MyApp::Application.configure do
  # Enable logging on Heroku
  config.logger =

  # rest of config removed ..

I was checking the forks of rails_log_stdout and noticed that it looks like Heroku is working on a new gemified version of the plugin, so hopefully this will start to work like expected soon.