You did not provide enough information to diagnose your problem (for example, what the :: Delegation method is and how it relates to Log4perl), but my common sense tells me that you probably have a wrapper method from which you call Log4perl methods. You must increase the value $Log::Log4perl::caller_depthinside this shell (and decrease it after calling in Log4perl) to determine the correct location.
eg. in Moose , I use:
package MyApp::Role::Log;
use MooseX::Role::Strict;
use Log::Log4perl;
my @methods = qw(
log trace debug info warn error fatal
is_trace is_debug is_info is_warn is_error is_fatal
logexit logwarn error_warn logdie error_die
logcarp logcluck logcroak logconfess
);
has '_logger' => (
is => 'ro',
isa => 'Log::Log4perl::Logger',
lazy_build => 1,
handles => \@methods,
);
around $_ => sub {
my $orig = shift;
my $this = shift;
local $Log::Log4perl::caller_depth += 4;
my $return = $this->$orig(@_);
$Log::Log4perl::caller_depth -= 4;
return $return;
} foreach @methods;
sub _build__logger
{
my $this = shift;
Log::Log4perl->easy_init() if not Log::Log4perl::initialized();
return Log::Log4perl->get_logger(ref $this)
}
no MooseX::Role::Strict;
1;
Note that the CPAN module MooseX :: Log :: Log4perl does not increment the caller_depth value, which definitely should be.
Ether source
share