On Sun, 30 Jan 2011, David Christensen wrote:
> Putting the 'use' statement before the 'BEGIN' statement makes Perl
> happy, but %c still shows the Helper package, not 'main':
Ugh, that doesn't work in :easy mode, sorry about that.
What you want to do instead is use the long form with get_logger():
package Helper;
use Log::Log4perl qw(get_logger);
Log::Log4perl->wrapper_register(__PACKAGE__);
sub help { get_logger()->debug(__FILE__, "-", __LINE__, ' ', @_) }
package Foo;
sub foo { Helper::help("blah"); }
package main;
use Log::Log4perl qw(:easy);
Log::Log4perl->easy_init({layout=>'%c %m %n'});
DEBUG(__FILE__, "-", __LINE__);
Helper::help(__FILE__, "-", __LINE__);
Foo::foo();
-- Mike
Mike Schilli
[email protected]
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
log4perl-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/log4perl-devel