Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ustun/4c7646e51140ec8e3f11fbfa0fbfb542 to your computer and use it in GitHub Desktop.
Save ustun/4c7646e51140ec8e3f11fbfa0fbfb542 to your computer and use it in GitHub Desktop.
Some Notes on Django and Celery Logging:
1. logging_tree is very useful. logging_tree.print_output()
2. Celery by defaults hijacks the logger, and overwrites its handler and formatter.
You can set it to not hijack, in which case the root logger will be preserved, except for its level.
The level of the root logger is still hijacked by the celery process.
3. Django has its own default logging, which is merged with our logging. To disable old logging,
disable_existing_loggers does not help. It simply suppresses the messages of existing loggers.
It does not remove loggers. (See latest Django logs.)
4. Unlike runserver, multiple celery processes can run, which means logging might get confused if you open two
celery processes. One message will go to one process, the other to the next process etc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment