Django Unhandled Exception

Just connect to the got_request_exception signal and log the exception:

from django.core.signals import got_request_exception
import logging    

def log(*args, **kwargs):
    logging.exception('error')

got_request_exception.connect(log)

This will log the whole trace. In the dev server, it logs in the console.

Leave a Comment