Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I disable Log4perl output for a particular class?

I would like to use Log4perl in a project but disable it for a certain class (which is, in this case Net::Amazon). I thought this would be an easy one, but somehow I failed.

I tried using

use Log::Log4perl (:easy_init);
use Net::Amazon;

my $amz = Net::Amazon->new( ... );
my $log = Log::Log4perl->easy_init($DEBUG);
$log = $log->get_logger("Net::Amazon");
$log->level($OFF);

$log = $log->get_logger(__PACKAGE__);
$log->info("Hello World.");

Unfortunately, debugging messages of Net::Amazon are still printed to the terminal. Why is that? And what am I doing wrong here?

like image 759
Simon Avatar asked Oct 22 '09 15:10

Simon


1 Answers

I think you mean

    $log->get_logger("Net::Amazon")->level($OFF)
like image 50
mob Avatar answered Oct 07 '22 22:10

mob