Django logs shell exceptions (with Django > 2.0)
See original GitHub issueI’m not completely sure whether this is a change in Django or in Raven.
I’ve started seeing typos in the manage.py shell
log to Sentry since I upgraded to django 2.0, raven 6.4.0 and Python 3.6. I’ve come up with a hacky work around, but it did clarify that there’s no easy way to disable the sentry client that I could find documented.
Is there any change at this end which might have caused this?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:14
- Comments:12 (2 by maintainers)
Top Results From Across the Web
Logging - Django documentation
Overview. Django uses and extends Python's builtin logging module to perform system logging. This module is discussed in detail in Python's own documentation; ......
Read more >Logging - Django documentation
A quick logging primer. Django uses Python's builtin logging module to perform system logging. The usage of this module is discussed in detail...
Read more >Django 2.0 release notes
Django 2.0 supports Python 3.4, 3.5, 3.6, and 3.7. We highly recommend and only officially support the latest release of each series.
Read more >Testing tools - Django documentation
If you point the test client at a view that raises an exception and Client.raise_request_exception is True , that exception will be visible...
Read more >How to *always* log exceptions and stacktraces in django with ...
Though there is no default config where all exceptions are being recorded in a log file, there are couple of options for you...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think I’ve tracked this down to the (good!) change that happened between 6.0.0 and 6.1.0:
PR: https://github.com/getsentry/raven-python/pull/966
Original issue: https://github.com/getsentry/raven-python/issues/884
Since install_sys_hook is working correctly, exceptions raised within a
manage.py|django-admin.py
session are handled by Sentry.Here is a basic workaround I’ve settled on (YMMV):
In should_capture, the wildcard
"*"
will match any exception.Other
manage.py
commands that don’t have a “shell” argument will continue to send exceptions to Sentry.@jacobwegner it still works (thanks!), but I think in your solution you meant
("*",)
instead of("*")
?