Graf László wrote:
Hi gurus

I have the following configuration:

   UHU-Linux 1.1 (www.uhulinux.hu)
   httpd-2.0.49
   perl 5.8.3
   mod_perl-1.99_13
   Log::Log4perl 0.41

Graf, please always submit problem reports as explained here: http://perl.apache.org/bugs/

The problem is that, the Log::Log4perl used within test.pl (see below)
works fine, entering the "test message" into the /var/log/log4perl.log
file, each time when I run x.pl. Used within RequestHandler.pm (see below)
it does not work.

What is wrong?

What does $logger->error do under the hood? Should you check the success of this call and log an error if it fails? If not if it thinks it succeeds then it probably has something to do with filehanle redirection. Have you checked t/logs/error_log (in case Log::Log4perl prints via STDERR)


RequestHandler.pm
-----------------
package GL::BASE::RequestHandler;
@ISA = qw();
use Log::Log4perl;
Log::Log4perl::init('/etc/log4perl.conf');
$logger = Log::Log4perl->get_logger('GL::BASE::RequestHandler');
sub handler ($$) {

Under mod_perl 2, this needs to be written as:


sub handler : method {

if you want to use object handlers. Please read:
http://perl.apache.org/docs/2.0/user/porting/compat.html#Method_Handlers

my($r) = @_;

and even under mod_perl that would be wrong, since a class would be the first argument there. I guess you did it because it wasn't giving you the class argument.


    $logger->error("in");
    $logger->error("out");
    return 0;
}

is this handler invoked at all? It doesn't send any response. Add some warn "foo" so you know it was called.


httpd.conf
----------
PerlInitHandler Apache::Reload
# PerlSetVar ReloadDebug On
# PerlSetVar ReloadModules "GL::*"
Alias /p/ /proba/
<Location /proba/>
     SetHandler perl-script
     PerlHandler GL::BASE::RequestHandler->handler

That should be PerlResponseHandler (unrelated to your problem). See the same doc quoted above.


</Location>


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Reply via email to