PerlCleanupHandler called from default-handler

2003-03-04 Thread Tom Murphy

I have written a Apache::DBILogger style log mechanism.  It is enabled via
the perl.conf in the Server context as:
 
PerlCleanupHandler  NC::LogHandler
 
It works correctly, except for the fact that request handle by the
default-handler do not call this handler.  The mod_perl cookbook makes note
that: ..a C module has to specifically want this processing to occur-it is
not called automatically.   How do I allow for this handler to be called on
all requests?  Note I also tried this as a PerlLogHandler to no avail.
 
TIA,
 
Tom Murphy


Re: PerlCleanupHandler called from default-handler

2003-03-04 Thread Geoffrey Young


Tom Murphy wrote:
I have written a Apache::DBILogger style log mechanism.  It is enabled via
the perl.conf in the Server context as:
 
PerlCleanupHandler  NC::LogHandler
 
It works correctly, except for the fact that request handle by the
default-handler do not call this handler.  The mod_perl cookbook makes note
that: ..a C module has to specifically want this processing to occur-it is
not called automatically.   
well, what we said is true, but you're reading it the wrong way :)

basically, all of the Perl*Handler directives - from 
PerlPostReadRequestHandler to PerlCleanupHandler - can be thought of as 
parts of the request cycle.  however, this is true for all but the 
PerlCleanupHandler, which really isn't part of the request cycle - mod_perl 
just makes it look that way.  what's really happening is that mod_perl is 
hooking your Perl handler into the per-request cleanup that Apache offers 
all C modules (mod_perl included).  so it _should_ be called for every 
request it is configured to run for (should being highly caveated - people 
have reported that _sometimes_ this doesn't really happen).

understanding that is A Good Thing.  however, it's not going to help you 
very much here :)

How do I allow for this handler to be called on
all requests?  Note I also tried this as a PerlLogHandler to no avail.
if the PerlLogHandler doesn't get called then you probably have a 
configuration problem.  both of these can exist on their own, outside of a 
container. something like

PerlLogHandler NC::LogHandler
Location foo
  ...
if that doesn't show your log handler running then you need to check your 
error log for errors and make sure your handler compiles under perl -cw or 
something - if the log handler errors out, you really can't see it unless 
you look.

of course, all this assumes that you built with EVERYTHING=1 - check 
Apache::Status to make sure.

another thing you can try if that doesn't work out is compiling a debugging 
mod_perl (PERL_DEBUG=1 and PERL_TRACE=1 when building) and set PerlSetEnv 
MOD_PERL_TRACE on and watch the verbose output.

HTH

--Geoff