note
Joost
<blockquote>then each module needs to start out with
<p>
<code>
use Log::Log4perl qw(:levels);
my $logger = Log::Log4perl->get_logger(__PACKAGE__);
$logger->level($DEBUG);
</code>
</blockquote>
Well, it's still one line less than log4j :-)
<p>
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...
<p>
Anyway, you could make your own wrapper module and mess around with <code>import</code> and <code>caller</code> to let it be used like this:
<code>
use Mylog;
#...
$LOG->warn("bla"); # $LOG is presumably a package global
</code>
or even
<code>
use MyLog 'debug';
$LOG->warn("stuff");
</code>
<p>
Joost.
<div class="pmsig">
<div class="pmsig-157432">
<em>[id://149675|"What should it profit a man, if he should win a flame war, yet lose his cool?"]</em>
</div></div>
357854
357854