[Fixed]-Heroku logs for Django projects missing errors

11👍

Looks like it was simply a problem caused by an expectation that Django under Heroku would work like Rails. Silly me.

For anyone else suffering this problem when moving from one framework/language to another:

  • When debug is off, Django uses the standard Python logger to handle errors in the code.
  • There is a default set-up at the bottom of settings.py which emails the site admins when there are errors. Nice. It needs an array of email addresses in the ADMINS variable in settings.py to work.
  • Errors are sent, by default, to STDERR instead of STDOUT, so they won’t show in the logs. This can be changed apparently. Try here if you want this behaviour:

    http://codeinthehole.com/writing/console-logging-to-stdout-in-django/

0👍

This behavior is set by the server (e.g. gunicorn), not Django or Heroku.

There’s usually a command line or configuration that changes the default log level.

-6👍

This can be solved just by changing your DEBUG in your settings.py file.
DEBUG=True

Leave a comment