This information is most helpful in understanding what is going on.
That would be the logical thing to think that the during the perlhandler
phase the content() gets sucked up and isn't available for 

I looked for more information about using Apache::Request->instance($r) and
only came up with a small snippet from:
http://perl.apache.org/docs/1.0/guide/snippets.html#Reusing_Data_from_POST_request

"If you are using Apache::Request, it solves this problem for you with its instance() 
class method, which allows Apache::Request to be a singleton. This means that whenever 
you call Apache::Request->instance() within a single request you always get the same 
Apache::Request object back."

This is what I have below, the problem I'm trying to solve is getting the params (text 
field etc.) that were passed to a cgi script.  This Apache module is being called in 
my httpd.conf by "PerlLogHandler Apache::ErrorLogger". 

It doesn't seem to be getting the params at this point from the POST, I'm probable 
calling it wrong or using it in the wrong way ?   

 package Apache::ErrorLogger;
  
 use strict;
 use Apache::Constants qw( :common );
 use Apache::Log;
 use Apache::Request;

sub handler {
        #shift->post_connection(\&logger);
        my $r = shift->last;

        my $apr = Apache::Request->instance($r);
        my $content = $apr->content();

       &Bomb({display=>0, footer=>0, level=>3,  exit=>0, output=>'text',
                       error=>"Paramterts: >^..^< content: $content ",
                       logfile=>'/var/apache_logfile'
                      });

        return OK;
}

-----Original Message-----
From: Tom Schindl [mailto:[EMAIL PROTECTED]
Sent: Saturday, January 10, 2004 8:14 AM
To: Ben Carlson
Cc: [EMAIL PROTECTED]
Subject: Re: Mod Perl + Apache Error logs, extend DBILogger


Hi,

I'm not sure whether I'm right or wrong. Your problem is that the 
logging phase is coming after the PerlHandler-phase and that $r->content 
from the PerlHandler-phase has already consumed the posted data.

To come across this problem you could use Apache::Request which works as 
a singleton any where to access the submitted parameters.
------------------------8<------------------------
my $apr = Apache::Request->instance($r)
------------------------8<------------------------

Tom


> What I would like to do is for a given request to a cgi program (or mason) if the 
> script causes an internal error (which should not happen in production, but does) I 
> would like to capture the parameters that were called from the cgi form so that 
> later on I can look to see what cgi program it was that caused the problems and what 
> parameters the user used to cause the problem.
  
> So far what I have works, except for getting information from $r->content(), what I 
> have done is placed the directive "PerlLogHandler Apache::ErrorLogger" which calls 
> the script below, which is placing information into the logfile.  The $r->args() 
> call works, when I place parameters in the URL after the '?' it does get this 
> information.  What I really need though is the content in the content() call.
  
> The form does have 'application/x-www-form-urlencoded' in the form tag.  Is the 
> content() not coming through because apache redirects to the error page ?  



** ** **  PRIVILEGED AND CONFIDENTIAL  ** ** **
This email transmission contains privileged and confidential information 
intended only for the use of the individual or entity named above.  Any 
unauthorized review, use, disclosure or distribution is prohibited and 
may be a violation of law.  If you are not the intended recipient or a 
person responsible for delivering this message to an intended recipient, 
please delete the email and immediately notify the sender via the email 
return address or mailto:[EMAIL PROTECTED]  Thank you.


--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html

Reply via email to