[mod_python] outputting to apache log

Jim Gallacher jpg at jgassociates.ca
Sun Jul 9 13:15:36 EDT 2006


greg wrote:
> I have some session data that I would like to write into the apache log,
> to be used with a stats tool. (Prefereably NOT the error log.)
> 
> PythonLogHandler looks like it should be related to this task, but I
> could find nothing about writing a custom one in the docs:
> 
> http://www.modpython.org/live/current/doc-html/dir-handlers-plh.html
> 
> What's the best way to put data into the log?

I haven't used PythonLogHandler myself, but I suspect it doesn't do what
you think does.

Putting PythonLogHandler in your apache config will cause your handler
to be called by apache during logging phase, which is the second to last
phase - cleanup being the last. What you do in your handler is entirely
up to you, such as logging to a separate file, database, error log, or
whatever.

AFAIK there is no functionality exposed in mod_python that allows you to
interact with the access log, or if this is even possible.

Jim




More information about the Mod_python mailing list