This is now documented on Unicorn, which supercedes this forum thread. Head over there.
Documenting this as a forum thread since we received a question about it.
Important: Very few Heroku users will encounter this problem. If you haven't installed unicorn manually, ignore this.
When a Rails app is deployed, Heroku injects rails_log_stdout,
which redefines Rails'
Logger so all output goes to
STDOUT. This doesn't work as expected with unicorn and
only rack output is logged.
To output app logs, edit
config/environments/production.rb or the environment
configuration for your Heroku environment.
MyApp::Cofiguration.configure .. end block,
add these 2 lines:
config.logger = Logger.new(STDOUT) config.logger.level = Logger.const_get(ENV['LOG_LEVEL'] ? ENV['LOG_LEVEL'].upcase : 'INFO')
These create a new
Logger class which outputs to
STDOUT, then sets its log level.
Note: the second line should set
config.log_level. Comment out any existing assignments
config.log_level; they won't take effect.
INFO to the log level you want to run by
default. That's typically
INFO in production, though
DEBUG (more verbose) and
verbose) are common.
To change the log level of your running Heroku app, run:
heroku config:add LOG_LEVEL="debug"
debug is the desired log level. Your app
will restart immediately at the new log level.
Optionally, you can tell Heroku not to inject rails_log_stdout since it's no longer needed.
To do so, create an empty
vendor/plugins/rails_log_stdout/ directory containing
a placeholder file and commit it to your git repo:
mkdir -p vendor/plugins/rails_log_stdout touch vendor/plugins/rails_log_stdout/keep_me git add vendor/plugins/rails_log_stdout/keep_me git commit -m "Placeholder file to disable rails_log_stdout" vendor/plugins/rails_log_stdout/keep_me