ryanb/cancan — Issue #511: CanCan breaks rails logger on Heroku
Author: emiltin
Created: 2011-11-11 06:49:13+00:00
State: open

When cancan is installed on a rails 3 app deployed on Heroku's new cedar stack, calling logger.error(), logger.info(), etc doesn't write anything to the log file.

I've been in touch with their support, and here what they say:

To make logging work we inject a plugin that redirects logger input to STDOUT.

https://github.com/ddollar/rails_log_stdout

Some gems interfere with that if they make changes to the default rails logger. I had some free time today, so I went ahead an debugged this. The two gems that are causing problems are 'cancan' and 'simple-navigation'.

There is a way to work around this if you want to keep those gems. You can disable the plugin by creating a vendor/plugins/rails_log_stdout dir in your application, and add a dummy file to it (like a .gitignore) so the directory will end up in git. This will stop this plugin being installed, so you can set the logger in production.rb to log to STDOUT yourself:

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

Please let me know if this doesn't work for you.