question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Django Debug Toolbar prevents logging/tracebacks appearing in runserver

See original GitHub issue

Let’s say I start Django channels server with command: python3 manage.py runserver 0.0.0.0:8001 There is no any customisation in settings.py regarding Logging except DEBUG = True

And all what I can see in logging are 4 types of messages: WebSocket HANDSHAKING, WebSocket CONNECT, WebSocket DISCONNECT and WebSocket REJECT

Even if I set assert False right before self.connect(), the only logs I get:

WebSocket HANDSHAKING /core/ [192.168.122.4:52494]
WebSocket DISCONNECT /core/ [192.168.122.4:52494]

Yes, just 2 lines. Nothing about assertion error or anything else.

This is how it suppose to be? How can I see the same logging that shows errors as it was on WSGI?

I’m using latest channels package, taken from github. There are some “fixes” in runserver.py file, but still the same. No normal logging, just messages about websocket sessions state.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
mariocesarcommented, Jul 2, 2020

Sorry to reopen this discussion with a comment. But this mades lost days of works, trying to find a proper solution, I particularly have lot of rules in my LOGGING config so disabling the logging in the develop mode was really inconvenient.

Another solution and a more clean one, is to remove the logging panel that is enable by default in django debug toolbar.

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",
    # "debug_toolbar.panels.logging.LoggingPanel",
    "debug_toolbar.panels.redirects.RedirectsPanel",
    "debug_toolbar.panels.profiling.ProfilingPanel",
]

Just that fixes the issues, you keep django debug toolbar working for your http requests and have also the tracebacks in the console.

Hope is useful for others

1reaction
andrewgodwincommented, Jan 3, 2019

Thanks for reminding me of that, @matthiask! I will close this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

unable to run server when django debug toolbar is enabled
Finally, found the answer that we have an infinite loop of DEBUG_TOOLBAR set in our multiple settings file, so it's causing a loop...
Read more >
Configuration — Django Debug Toolbar 3.8.1 documentation
Don't copy-paste blindly the default values shown below into your settings module! It's useless and it'll prevent you from taking advantage of better ......
Read more >
Installation — Django Debug Toolbar 3.8.1 documentation
The Debug Toolbar is shown only if your IP address is listed in Django's INTERNAL_IPS setting. This means that for local development, ...
Read more >
Release 3.7.0 unknown - Django Debug Toolbar
The Debug Toolbar is shown only if your IP address is listed in ... On some platforms, the Django runserver command may use...
Read more >
Panels — Django Debug Toolbar 3.7.0 documentation
Panels can ship their own templates, static files and views. All views should be decorated with debug_toolbar.decorators.require_show_toolbar to prevent ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found