Log4perl developers,

Thanks for the work on this module.  It's saved me countless rewrites,
and has adapted beautifully with my needs.  Unfortunately, I've
noticed an issue with logdie (and the related methods).  I've wrapped
Log::Log4perl to add some functionality.  I've noticed that when I do
a logdie (or similar), I get the wrong file/line on the die text:

$ perl -I perllib -MWSL::Util::Log=logger_cat,wsl.stdout -e
'WLOGGER->logdie("This should die")'
FATAL> -e:1 main:: - This should die
This should die at perllib/WSL/Util/Log/Log4perl.pm line 174
## Should be ##
This should die at -e line 1

It prints the write file/line on the logged message (-e:1), but not on
the die message (perllib/WSL/... line 174).  I've created a work
around in my wrapping code by incrementing
$Log::Log4perl::caller_depth, but this feels like a hack, as I've
already registered the package as a wrapper with
Log::Log4perl->wrapper_register( __PACKAGE__ );.  I believe the
correct fix is to change the Log::Log4perl::Logger::callerline method
to use the %WRAPPERS_REGISTERED hash, similar to
Log::Log4perl::get_logger:

my $level = $Log::Log4perl::caller_depth;
my ($pack, $file, $line);
do { ($pack, $file, $line) = caller(++$level)
} while ( exists $Log::Log4perl::WRAPPERS_REGISTERED{ $pack } );

Although if you're replicating code, you should be wrapping the
duplication in a function somewhere and just calling that.

I would appreciate it if you could let me know if/when the issue will
be addressed.

  -- Bob

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
log4perl-devel mailing list
log4perl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/log4perl-devel

Reply via email to