Cees posted this on Perlmonks and it "works" but I get [undef] for
filename and line.

sub get_logger {
     my $class = shift;
     my $module_name = shift;

     unless( Log::Log4perl->initialized ) {

         # watch the config file for changes (in seconds)
         Log::Log4perl->init_and_watch( "log4perl.conf", 60 );
         $Log::Log4perl::caller_depth = 1;
     }

     return Log::Log4perl->get_logger( $module_name );
}

I am not calling it from a module but a "test.pl" file. It logs but I get:

[2007/08/21 12:39:21] [WARN] [[undef] line [undef]] This should go to
SCREEN and AMG.LOG

Is it because I am not calling it from a module?

How do I change that wrapper to play nicely with Log4perl?

Bob

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to