17
Jun
2011

Filed under: django, logging

4 comments

Introducing django-peavy

Continuing my apparent obsession with logging, I've just released django-peavy. It's a collection of logging support code for capturing your Django application logging to a database, and a (really) basic user interface for reviewing it. Notable features include:

  • Middleware to tag each request with a unique ID.
  • Logging filters to capture request metadata like user, remote IP, and headers.
  • Logging handlers for:
    • Capturing exception information, including a copy of the Django server error page, in a database.
    • Sending error notifications to admins without revealing sensitive information like the contents of request.POST.
  • A database router for sending log records to a separate database (though there are problems with South migrations you'll need to work around to do so).
  • A simple user interface for browsing log records in the database.

It's available on PyPI, so you can install it with pip. It does require South and Django 1.3; pip should install them automatically if needed.

It's also on GitHub. Both locations include documentation on installation and configuration.

Finally, a screenshot of the current UI (did I mention it's pretty barebones at the moment?):

django-peavy UI screenshot

Comments (4)

maxk — 19 June 2011 5:10
Have you had a chance to look at django-sentry? Features of yours app looks pretty similar.
jMyles — 19 June 2011 14:24
This doesn't use the actual django logging utils? Or am I misreading the models?
john — 19 June 2011 23:02
@maxk -- First NIH post! :^) If Sentry does what you need, it's more mature, it's in production at a huge Django site, and by all means, you should use it.
john — 19 June 2011 23:10
@jMyles -- you lost me; I don't know which actual django logging utils you mean. It does use the regular server error page construction for capturing details of requests that encounter exceptions. It provides an alternative to the AdminEmailHandler. All other logging is handled according to your logging config, which could involve peavy.models, but doesn't have to.

leave a comment