mod_python and logging

Vinay Sajip vinay_sajip at yahoo.co.uk
Mon May 16 11:19:04 EDT 2005


Daniel Lichtenberger <daniel_usenet <at> yahoo.de> writes:

> I'm looking for a logging module to be used in a mod_python-powered
> website. Python 2.3's logging package seems like a good fit, however
> I'm not sure if it's completely safe to use it under high load. The
> library documentation states that it's thread-safe, but what about
> several forked apache processes running different (sub-)interpreters,
> logging to the same file? 

If you want to have multiple processes logging to the same file, the standard
Python logging module does not support interprocess synchronisation directly.
However, it is fairly easy to set up the processes to log events to a socket,
and a socket receiver can log received events to file. The online docs have an
example socket receiver:

http://docs.python.org/lib/network-logging.html

> Other suggestions for logging (I really don't need most of logging.*'s
> facilities) are also welcome.

Are you sure you'll never need them in the future?


Vinay Sajip




More information about the Python-list mailing list