You did not specify a registration category, so your code executes the equivalent
Log::Log4perl->get_logger(__PACKAGE__);
where __PACKAGE__is Example::Testinside your module and maininside your script.
From the documentation :
"Loggers" Log4perl, , . Log::Log4perl , . - , ...
, , , , -.
, Example::Test Log:: Log4perl, :
package My::Wrapper;
use strict;
use warnings 'all';
use 5.010;
use Log::Log4perl;
Log::Log4perl->wrapper_register(__PACKAGE__);
sub foo {
my $logger = Log::Log4perl->get_logger;
say $logger;
$logger->warn('foo');
}
1;
My::Wrapper::foo() main, main::.
source
share