Skip Menu |

This queue is for tickets about the Log-Log4perl CPAN distribution.

Report information
The Basics
Id: 99361
Status: resolved
Priority: 0/
Queue: Log-Log4perl

People
Owner: Nobody in particular
Requestors: gurub_n [...] yahoo.co.in
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: reinitializing Log4perl does not reset additivity. Bug?
Date: Tue, 7 Oct 2014 16:47:05 -0400
To: bug-Log-Log4perl [...] rt.cpan.org
From: G <gurub_n [...] yahoo.co.in>
Hi, I have a perl test harness and couple of supporting modules. I use Log4perl for logging. I initialize the logger at init of my harness. Everything related to logging works fine with this configuration. There are few users who reinitialize the logger. But it looks like after every time you initialize the logger, everything gets reset except the additivity. Because of which all log statements related to that category won't get logged. Sample scenario: say my config has this line ... log4perl.logger.some.module = INFO, someAp log4perl.additivity.some.module = 0 ... After reinitialization, the log4perl.logger.some.module = INFO, someAp gets reset, but additivity still persists. Any log statements from some.module won't be logged at all. As a workaround, I am keeping track of additivity and i am explicitly unsetting it at the reinitialization time. -- regards, ​gurub_n​
On Tue Oct 07 16:47:14 2014, gurub_n@yahoo.co.in wrote: Show quoted text
> Sample scenario: say my config has this line > log4perl.logger.some.module = INFO, someAp > log4perl.additivity.some.module = 0
I've tried to reproduce the problem you've reported, but found that it works as expected: use strict; use Log::Log4perl qw(:easy); my $conf = <<EOT; log4perl.logger.some.module = INFO, someAp log4perl.additivity.some.module = 0 log4perl.appender.someAp = Log::Log4perl::Appender::Screen log4perl.appender.someAp.layout = Log::Log4perl::Layout::SimpleLayout EOT Log::Log4perl->init(\$conf); my $logger = get_logger( "some::module" ); $logger->info( "Hooray!" ); print "Additivity: ", $logger->additivity(), "\n"; $logger->additivity(1); print "Additivity: ", $logger->additivity(), "\n"; Log::Log4perl->init(\$conf); print "Additivity: ", $logger->additivity(), "\n"; Can you post code that reproduces the problem?
Subject: Re: [rt.cpan.org #99361] reinitializing Log4perl does not reset additivity. Bug?
Date: Thu, 9 Oct 2014 00:56:28 -0400
To: bug-Log-Log4perl [...] rt.cpan.org
From: G <gurub_n [...] yahoo.co.in>
Hi Micheal, Thanks for the quick reply! Below is the script which reproduces the scenario: use strict; use Log::Log4perl qw(:easy); my $conf = <<EOT; log4perl.logger.some.module = INFO, someAp log4perl.additivity.some.module = 0 log4perl.appender.someAp = Log::Log4perl::Appender::Screen log4perl.appender.someAp.layout = Log::Log4perl::Layout::SimpleLayout EOT my $conf2 = <<EOT; log4perl.rootLogger = INFO, someAp2 log4perl.appender.someAp2 = Log::Log4perl::Appender::Screen log4perl.appender.someAp2.layout = Log::Log4perl::Layout::SimpleLayout EOT Log::Log4perl->init(\$conf); my $logger = get_logger( "some::module" ); $logger->info( "Hooray!" ); print "Additivity: ", $logger->additivity(), "\n"; Log::Log4perl->init(\$conf2); print "Additivity: ", $logger->additivity(), "\n"; some::module->test(); #any log lines from some.module wont be logged. #comment out line 24 and you will see the log line from some::module::test package some::module; use Log::Log4perl qw(:easy); sub test { $logger->info( "This wont be logged" ); } Thanks, On Wed, Oct 8, 2014 at 2:47 AM, Michael_Schilli via RT < bug-Log-Log4perl@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=99361 > > > On Tue Oct 07 16:47:14 2014, gurub_n@yahoo.co.in wrote:
> > Sample scenario: say my config has this line > > log4perl.logger.some.module = INFO, someAp > > log4perl.additivity.some.module = 0
> > I've tried to reproduce the problem you've reported, but found that it > works as expected: > > use strict; > > use Log::Log4perl qw(:easy); > > my $conf = <<EOT; > log4perl.logger.some.module = INFO, someAp > log4perl.additivity.some.module = 0 > log4perl.appender.someAp = Log::Log4perl::Appender::Screen > log4perl.appender.someAp.layout = Log::Log4perl::Layout::SimpleLayout > EOT > > Log::Log4perl->init(\$conf); > > my $logger = get_logger( "some::module" ); > $logger->info( "Hooray!" ); > print "Additivity: ", $logger->additivity(), "\n"; > > $logger->additivity(1); > print "Additivity: ", $logger->additivity(), "\n"; > > Log::Log4perl->init(\$conf); > print "Additivity: ", $logger->additivity(), "\n"; > > Can you post code that reproduces the problem? >
On Thu Oct 09 00:56:38 2014, gurub_n@yahoo.co.in wrote: Show quoted text
> Below is the script which reproduces the scenario:
Oh, OK, I see now, you're using the same $logger reference. Unless you obtain a new logger via my $logger = get_logger( "some::module" ); the logger is still the old one and has the old additivity. Log4perl can't take away your old loggers if you're holding on to them, but if you get a new one, you'll get the new behavior. Hope that helps!