Elegant setup of Python logging in Django
Posted
by Parand
on Stack Overflow
See other posts from Stack Overflow
or by Parand
Published on 2009-10-21T05:07:01Z
Indexed on
2010/04/14
4:22 UTC
Read the original article
Hit count: 317
I have yet to find a way of setting up Python logging with Django that I'm happy with. My requirements are fairly simple:
- Different log handlers for different events - that is, I want to be able to log to different files
- Easy access to loggers in my modules. The module should be able to find its logger with little effort.
- Should be easily applicable to command-line modules. Parts of the system are stand-alone command line or daemon processes. Logging should be easily usable with these modules.
My current setup is to use a logging.conf
file and setup logging in each module I log from. It doesn't feel right.
Do you have a logging setup that you like? Please detail it: how do you setup the configuration (do you use logging.conf
or set it up in code), where/when do you initiate the loggers, and how do you get access to them in your modules, etc.
© Stack Overflow or respective owner