Re: glue between apache and python logging

2005-10-21 Thread Nic Ferrier
Jim Gallacher <[EMAIL PROTECTED]> writes: > For some reason all this talk of logging makes me want to sing, sing, > sing... > > Well I'm a lumberjack and I'm OK... Shurely the wrong song, it should be the song of our alma mater: Ohh! John Stewart Mill of his own free will Drank elev

Re: glue between apache and python logging

2005-10-20 Thread Nic Ferrier
"Graham Dumpleton" <[EMAIL PROTECTED]> writes: > Either way, to get the flexibility you want, user code still has to do > the association of a log handler to a specific logger at some point, eg. > preferably in a PythonImport module and only once. Adding a default > apache log handler against "mod

Re: glue between apache and python logging

2005-10-20 Thread Nic Ferrier
"Graham Dumpleton" <[EMAIL PROTECTED]> writes: > Nic wrote: >> Programmers may or may not want to redirect logging through Apache. If >> mod_python used the system you describe there would either have to be: >> >> 1. config syntax to allow module 'logging' glue to be turned off >> >> 2. removal o

Re: glue between apache and python logging

2005-10-20 Thread Nic Ferrier
"Graham Dumpleton" <[EMAIL PROTECTED]> writes: > That is, a global log handler instance is created once only. No instance per > request handler invocation. > > As you point out you need though to do caching of request objects. I have > previously posted on a safe way of doing this which works for

Re: glue between apache and python logging

2005-10-20 Thread Nic Ferrier
Jim Gallacher <[EMAIL PROTECTED]> writes: > There is a typo in your code: s/logging.debug/logging.DEBUG/ Got me. It ran for me though... > Beyond that it still segfaults for me. I can't get it to segfault. Can you share your test? > The other problem is that you are not removing the handle

Re: glue between apache and python logging

2005-10-20 Thread Nic Ferrier
Jim Gallacher <[EMAIL PROTECTED]> writes: > My gut was right. Your current version segfaults (using mpm-prefork). It > might work if you register a cleanup to remove the reference to your > logging handler (untested): > > req.register_cleanup(log.removeHandler, hdlr) > > The problem here is that

Re: glue between apache and python logging

2005-10-20 Thread Nic Ferrier
Jim Gallacher <[EMAIL PROTECTED]> writes: >>>Furthermore, you can't depend on the request object being valid once >>>the request processing has completed. At some point request_tp_clear (in >>>requestobject.c) will get called and request->server will be set to >>>NULL. (At least I think this is

Re: glue between apache and python logging

2005-10-19 Thread Nic Ferrier
Jim Gallacher <[EMAIL PROTECTED]> writes: > Nicolas Lehuen wrote: >> In that case, setting up the logging handler should be done by the user, >> making sure that it is set up only once per interpreter, even in the >> context of a multi-threaded MPM. It's not a trivial thing ; looks like >> this

Re: glue between apache and python logging

2005-10-19 Thread Nic Ferrier
Nicolas Lehuen <[EMAIL PROTECTED]> writes: > One thing to remember : every piece of code we introduce into mod_python is > a liability. We'll have to support it and I can't wait for having to solve > setup problems of people asking the list "where are my log entries going ?" > or "my log entries a

Re: glue between apache and python logging

2005-10-19 Thread Nic Ferrier
Nick <[EMAIL PROTECTED]> writes: > Maybe I just don't have enough exposure, but I don't see the logging > module used as ubiquitously as you seem to imply. I could agree with > you if logging was used everywhere, even in Python and its standard > modules. I could be wrong, but I just don't se

Re: glue between apache and python logging

2005-10-19 Thread Nic Ferrier
Nicolas Lehuen <[EMAIL PROTECTED]> writes: > In that case, setting up the logging handler should be done by the user, > making sure that it is set up only once per interpreter, even in the context > of a multi-threaded MPM. It's not a trivial thing ; looks like this is a job > for PythonImport. H

Re: glue between apache and python logging

2005-10-19 Thread Nic Ferrier
Is everyone here called Nic[h]olas? Nicolas Lehuen <[EMAIL PROTECTED]> writes: > Nic, there is something I need to understand before giving my advice on the > subject. I'm not familiar with the logging API, can you tell me how you > configure Python to use this logging implementation ? Looks lik

Re: glue between apache and python logging

2005-10-19 Thread Nic Ferrier
Nicolas Lehuen <[EMAIL PROTECTED]> writes: > OK now this is totally weird, we've got a Nic, a Nick and a Nicolas in the > thread, watch out for mass confusion ! Bah. You got the joke first. Nic

Re: glue between apache and python logging

2005-10-19 Thread Nic Ferrier
Nick <[EMAIL PROTECTED]> writes: >> Nic Ferrier wrote: >>> >>> I just joined this list (at the suggestion of Graham Dumpleton) to try >>> and get you guys to consider adding some glue to connect python >2.2 >>> logging to Apache's log

glue between apache and python logging

2005-10-18 Thread Nic Ferrier
ing; it's use is purely optional. A very good reason for doing it is that it reduces dependancies for anyone wanting to do this (and it's a very obvious thing to want to do in any mod_python code). I wonder what you all think about this? BTW I'd be happy to maintain and support this if you agreed to include it. Nic Ferrier