Version 7 (modified by simon, 14 years ago) ( diff )

--

Integrating Python's standard library logging module with Django

Mailing list proposal and discussion: http://groups.google.com/group/django-developers/browse_thread/thread/8551ecdb7412ab22

Python Logging 101: http://plumberjack.blogspot.com/2009/09/python-logging-101.html

Current code: http://github.com/simonw/django/tree/logging - tracked in ticket #12012

The Plan

  1. DONE: Create a 'django' logger, hooked up to a NullHandler and with propagate=False so all logging is silent by default
  2. Start using loggers within Django itself (so far only the SQL logger is DONE, and that implementation could definitely be improved)
  3. DONE: Add a --loglevel command line switch to ./manage.py runserver to cause specified handlers to print to the console
  4. DONE: Add a mechanism for configuring loggers from Django's settings.py file using a LOGGING setting
  5. Add logging calls to exceptions that are turned in to 500 pages
  6. Figure out how users can get fine-grained control over their loggers by writing regular Python code

The plan is explained in more detail here: http://groups.google.com/group/django-developers/msg/7452fac3ae3b8175

Items marked DONE above aren't necessarily of production quality yet, but there's enough working code to see how they would look.

Logging from concurrent processes

If you're running logging within something like mod_wsgi or mod_python you can't just log straight to a file due to the need to handle multiple processes. Under mod_wsgi logging to stderr will cause log messages to end up in the Apache error log. If that's not good enough for you, consider the following options for logging from concurrent processes:

Note: See TracWiki for help on using the wiki.
Back to Top