Logging and Exception Handling for Django
summary
Covers Python's logging API and Django specifics: how settings.py provides a logging dict that gets handed to logging.dictConfig, how to create rotating FileHandler entries and wire handlers to django and root loggers, how logger.exception adds stack traces and how to include extra fields with a custom Formatter (example: hostname), how Django sends mail_admins when DEBUG is false, how to enable django.db.backends DEBUG for SQL, integrate Rollbar, and set sys.excepthook to capture uncaught crashes.
AI-written summary · about
chapters (23)
- 0:00Intro
- 1:43Objectives
- 4:28Success Criteria
- 5:00How Can Logs Help
- 7:37Out of the Box Django Logging
- 9:43Configuring Django Logging (cont.)
- 10:51Configuring File Handler
- 11:44Print Messages
- 14:34Logging Levels
- 15:49Four Basic Classes
- 17:19Logger Hierarchy by Example
- 20:05Filters Example
- 21:31Make Your Own Formatter
- 22:37Formatter Example
- 23:56Raising Exceptions
- 25:12Handling Exceptions (cont.)
- 28:12Invisible Exception Handlers
- 29:19Making Your Own Exceptions
- 30:51Re-Raising and Chaining Exceptions
- 31:52Third Party Packages
- 34:07Application Crash Not Reported
- 34:56The Exception Hook
- 37:00Additional Resources
related talks
30mEffortless Logging: A deep dive into the logging module
31mDevelopers Have the Logs Their Imagination Allows
11mUsing and abusing Python's logging module for more readable logs
11mUsing and abusing Python's logging module for more readable logs
27mHow to Solve Django's Top 5 Enterprise Headaches
19mPatterns for Extensibility
01h 06mEffective Django
48mPractical Django Secuirty
