|
@@ -47,8 +47,9 @@ Once installed, update your settings.py and add the middleware and installed app
|
|
|
'django.middleware.common.CommonMiddleware',
|
|
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
|
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
|
- ...
|
|
|
+ # placement is important
|
|
|
'djangodblog.middleware.DBLogMiddleware',
|
|
|
+ ...
|
|
|
)
|
|
|
|
|
|
INSTALLED_APPS = (
|
|
@@ -120,6 +121,9 @@ django-db-log supports the ability to directly tie into the ``logging`` module.
|
|
|
|
|
|
logging.getLogger().addHandler(DBLogHandler())
|
|
|
|
|
|
+ # Add StreamHandler to dblog's default so you can catch missed exceptions
|
|
|
+ logging.getLogger('dblog').addHandler(logging.StreamHandler())
|
|
|
+
|
|
|
You can also use the ``exc_info`` and ``extra=dict(url=foo)`` arguments on your ``log`` methods. This will store the appropriate information and allow django-db-log to render it based on that information:
|
|
|
|
|
|
logging.error('There was some crazy error', exc_info=sys.exc_info(), extra={'url': request.build_absolute_uri()})
|