django-debug-toolbar icon indicating copy to clipboard operation
django-debug-toolbar copied to clipboard

Debug toolbar's ThreadTrackingHandler mutes Daphne errors

Open JulienPalard opened this issue 5 years ago • 1 comments
trafficstars

In a "basic" setup, with django/channels, django/daphne, and debug-toolbar installed, and no specific configuration, Daphne logs are lost. I take daphne as an example, but any application or library not logging under the django namespace are lost the same (but could be displayed in the debug toolbar).

This is because we're relying, maybe too much, on the lastResort logger to log messages to stderr for any unconfigured logging namespace.

As debug-toolbar installs its ThreadTrackingHandler to the root logger, messages are considered handled by the logging module, which does not use the lastResort logger to log them to stdout: messages are not displayed (and while I'm in a websocket handler, I have no debug toolbar to display them to me).

JulienPalard avatar Jul 15 '20 14:07 JulienPalard

I also can confirm this. The issue is resolved by commenting out the LoggingPanel.

DEBUG_TOOLBAR_PANELS = [
    "debug_toolbar.panels.versions.VersionsPanel",
    "debug_toolbar.panels.timer.TimerPanel",
    "debug_toolbar.panels.settings.SettingsPanel",
    "debug_toolbar.panels.headers.HeadersPanel",
    "debug_toolbar.panels.request.RequestPanel",
    "debug_toolbar.panels.sql.SQLPanel",
    "debug_toolbar.panels.staticfiles.StaticFilesPanel",
    "debug_toolbar.panels.templates.TemplatesPanel",
    "debug_toolbar.panels.cache.CachePanel",
    "debug_toolbar.panels.signals.SignalsPanel",
    # Does not work with Django Channels, see
    # https://github.com/django/channels/issues/1204
    # "debug_toolbar.panels.logging.LoggingPanel",
    "debug_toolbar.panels.redirects.RedirectsPanel",
    "debug_toolbar.panels.profiling.ProfilingPanel",
]

Unfortunately, the following does NOT work:

DEBUG_TOOLBAR_CONFIG = {
    "DISABLE_PANELS": [
        'debug_toolbar.panels.logging.LoggingPanel',
    ]
}

medihack avatar Aug 11 '20 11:08 medihack

I'm closing this as closed in #1603. @medihack @JulienPalard, if that's not the case, please let me know.

tim-schilling avatar Aug 29 '22 01:08 tim-schilling

Thanks, I agree. Besides, if the bug is still there it would come up again.

matthiask avatar Aug 29 '22 05:08 matthiask