I would like to output debug messages in my django app at different points in a view function. The docs for the django-debug-toolbar say it uses the build in python logging but
If you have an existing LOGGING config dict, and you don't want to mess it up by switching to 'incremental', you'll need to re-add the DjDT log as a handler, then add it to the root logger's list of handlers.
from debug_toolbar.panels.logging import collector # needed for handler constructor below
LOGGING = {
# existing options, formatters, loggers, etc
handlers = {
# existing handlers
'djdt_log': {
'level': 'DEBUG',
'class': 'debug_toolbar.panels.logging.ThreadTrackingHandler',
'collector': collector,
},
},
'root': {
'level': 'DEBUG',
'handlers': ['djdt_log'],
},
}
If there's a cleaner way to do this, I'd love to see it.