Mike Schilli wrote:
 > We get tons of spam on this list, so it's moderated.

That's what I thought.  I'll post to the list and BCC you.


> 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__, ' ', @_) }

That solves both %c and 'category' -- thanks!  The 'category' filtering 
will be very useful.  :-)


I'm not certain if %T is doing the right thing (?).  You said there 
might be a bug.  Do you mean that the:

     ... Helper::help(...) called at ...

stances should be

     ... Log::Log4perl::__ANON__(...) called at ...

?  It's not a burning issue for me; I can use the output as is.


David



2011-01-30 19:53:41 dpchrist@p43400e ~/sandbox
$ nl log4perl-helper4.pl
      1 #!/usr/bin/perl
      2 package Helper;
      3 use Log::Log4perl qw(get_logger);
      4 Log::Log4perl->wrapper_register(__PACKAGE__);
      5 sub help { get_logger()->debug(@_, ' ', __FILE__, '-', __LINE__); }

      6 package Foo;
      7 sub foo { Helper::help(@_, ' ', __FILE__, '-', __LINE__); }

      8 package main;
      9 use Log::Log4perl qw(:easy);
     10 Log::Log4perl->easy_init({layout=>'%m %T %n'});
     11 DEBUG(       __FILE__, '-', __LINE__);
     12 print "\n";
     13 Helper::help(__FILE__, '-', __LINE__);
     14 print "\n";
     15 Foo::foo(    __FILE__, '-', __LINE__);

2011-01-30 19:55:32 dpchrist@p43400e ~/sandbox
$ perl log4perl-helper4.pl
log4perl-helper4.pl-13 Log::Log4perl::__ANON__('log4perl-helper4.pl', 
'-', 13) called at log4perl-helper4.pl line 13

log4perl-helper4.pl-15 log4perl-helper4.pl-5 
Helper::help('log4perl-helper4.pl', '-', 15) called at 
log4perl-helper4.pl line 15

log4perl-helper4.pl-17 log4perl-helper4.pl-8 log4perl-helper4.pl-5 
Helper::help('log4perl-helper4.pl', '-', 17, ' ', 'log4perl-helper4.pl', 
'-', 8) called at log4perl-helper4.pl line 8, 
Foo::foo('log4perl-helper4.pl', '-', 17) called at log4perl-helper4.pl 
line 17

2011-01-30 19:55:35 dpchrist@p43400e ~/sandbox
$ cat /etc/debian_version
5.0.8

2011-01-30 19:55:44 dpchrist@p43400e ~/sandbox
$ perl -v

This is perl, v5.10.0 built for i486-linux-gnu-thread-multi

Copyright 1987-2007, Larry Wall

Perl may be copied only under the terms of either the Artistic License 
or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.


2011-01-30 19:55:46 dpchrist@p43400e ~/sandbox
$ perl -MLog::Log4perl -e 'print $Log::Log4perl::VERSION, "\n"'
1.31

------------------------------------------------------------------------------
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
log4perl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/log4perl-devel

Reply via email to