mod_python and logging

  • Thread starter Daniel Lichtenberger
  • Start date
D

Daniel Lichtenberger

Hi,

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?

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

Thanks,
Daniel
 
V

Vinay Sajip

Daniel Lichtenberger said:
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
 
D

Daniel Lichtenberger

Hi!

Vinay said:
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

Thanks for the suggestion! Of course it's great to have a powerful and
flexible logging package, and it's still pretty easy to use.

Daniel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top