[mod_python] Problems with logging.

Kathryn Van Stone kvs at acm.org
Tue Nov 6 10:15:39 EST 2007

I am currently using mod_python version 3.3.1 with Apache 2.2.4 (and  
Python 2.5.1).  I've notice a difference between using  
apache.log_error and req.log_error. I modified mptest.py to the  

from mod_python import apache

def handler(req):
     apache.log_error('Test log from apache', apache.APLOG_DEBUG)
     req.log_error('Test log from request', apache.APLOG_DEBUG)
     req.content_type = 'text/plain'
     req.write('Hello World')
     return apache.OK

I modified the apache configuration to set the log level to debug.  I  
get the request log message, but not the apache log message. When the  
log level is raised to APLOG_NOTICE, I get both messages.

Any thoughts on why there is a difference?  We have areas where  
getting the request object is a hassle and would like to use  
apache.log_error. (Also there are members of my team who don't like  
the 'requestobject.c(823)' showing up in the log as it adds almost no  

-Kathy Van Stone
kvs at acm.org

More information about the Mod_python mailing list