In core/handlers/base.py, handle_uncaught_exception() does:

        if settings.DEBUG:
            from django.views import debug
            return debug.technical_500_response(request, *exc_info)

        logger.error('Internal Server Error: %s' % request.path,
            exc_info=exc_info,
            extra={
                'status_code': 500,
                'request':request
            }
        )

Wouldn't it make more sense to always log the exception?  As it stands now, 
it's an either/or deal.  If DEBUG, produce the debug page and don't log. 
 If not DEBUG, log and produce a normal 500 page.

I ended up writing my own process_exception() middleware to log stack 
traces for all uncaught exceptions.  This was fine in development, but in 
production, with DEBUG = False, I get *two* stacks in my log files for 
every exception (one from my hander, another from the code above).  This 
all seems silly.  It would be so much simpler (and obvious) if 
handle_uncaught_exception() always logged, regardless of which flavor of 
response it's going to produce.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/V01p8srjB_UJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to