quetz-mod_python-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Graham Dumpleton <grah...@dscpl.com.au>
Subject Re: glue between apache and python logging
Date Fri, 21 Oct 2005 21:44:41 GMT

On 22/10/2005, at 12:36 AM, Nick wrote:

> Graham Dumpleton wrote:
>
>> Anyway, I have attached an updated version of my log handler. This  
>> fixes
>> the issue with log levels that don't exactly map to any defined  
>> level.
>> Eliminates the explicit stack for storing request objects and in  
>> general
>> tries to make the module durable in the face of any module reloading
>> scheme for mod_python which exists now or which may exist in the  
>> future.
>> You can either use the default "mod_python" log it sets up, or create
>> explicit instances of ApacheLogHandler and add them against any log
>> within the hierarchy that you want.
>> Any feedback most welcome.
>>
>
> Seems kind of overly complicated to me.  If this was something to  
> be integrated into the mod_python core, I think it should probably  
> be implemented at a lower level, perhaps even set up by the  
> dispatcher before the first handler is dispatched and cleaned up at  
> the end automatically. That is, only if you have enabled some sort  
> of mod_python directive in the apache.conf file.  As it is now it  
> still seems sort of hack-ish.

Which bit is overly complicated? If you are talking about the mess with
sys.modules, that wouldn't be necessary if it was all a part of a module
in mod_python itself as standard global variables in the module or a
class static variable could be used in that case.

The strange stuff with sys.modules stuff was to protect against any
problems that can occur if people decided to take the sample code and
put it straight in their document tree somewhere where it could be
reloaded. You'll have to trust me that module reloading can cause some
nasty and hard to find problems. :-)

As to providing "handler()" this is again because it is a separate  
sample
distinct from mod_python. If a part of mod_python that can all be done
transparently. I didn't want to provide a sample where people had to
hack on their mod_python installation to try it.

> Additionally, if this is to fully interface with apache's log_error  
> function, then the other severities should be added as logging  
> levels, which is possible with logger.

Yeah, was thinking about how that could be done.

Graham

Mime
View raw message