Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Store Django Log messages in a database?

Tags:

logging

django

Django (the python web framework) uses python's logging system to store logs.

Is there an easy way to store log messages in a database, and then allow admin users to look over them via the web? It's the sort of thing I could write myself, but no point re-inventing the wheel. I don't want to log exceptions, but info/debug/notice type messages that I have added to the code.

Ideally I'd like to be able to store metadata about the log message as it's done (like the remote IP address, user agent, wsgi process id, etc.), and then filter / browse based on that (i.e. show me all log messages from this IP address in the last 24 hours). Has anyone done this?

like image 700
Amandasaurus Avatar asked Aug 09 '12 16:08

Amandasaurus


1 Answers

Just use Sentry. Raven, the Django piece of the functionality hooks into the logging framework, so in addition to collecting errors from your app, any custom log messages should show up as well.

like image 101
Chris Pratt Avatar answered Oct 19 '22 07:10

Chris Pratt