Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Log::Log4Perl best practices

by Joost (Canon)
on May 31, 2004 at 22:14 UTC ( [id://357857]=note: print w/replies, xml ) Need Help??


in reply to Log::Log4Perl best practices

then each module needs to start out with

use Log::Log4perl qw(:levels); my $logger = Log::Log4perl->get_logger(__PACKAGE__); $logger->level($DEBUG);
Well, it's still one line less than log4j :-)

I'm not sure you're supposed to set your own log-level inside the code since one of the strong points of Log4perl is that you can change log-levels using the config files while the program is running...

Anyway, you could make your own wrapper module and mess around with import and caller to let it be used like this:

use Mylog; #... $LOG->warn("bla"); # $LOG is presumably a package global
or even
use MyLog 'debug'; $LOG->warn("stuff");

Joost.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://357857]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2024-04-25 05:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found