Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: nwolff [...] hearst.com
Cc:
AdminCc:

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



Subject: $logger->more_logging(0) should not increase log level
Date: Wed, 30 Apr 2014 20:09:32 +0000
To: "bug-Log-Log4perl [...] rt.cpan.org" <bug-Log-Log4perl [...] rt.cpan.org>
From: "Wolff, Nic" <nwolff [...] hearst.com>
http://search.cpan.org/~mschilli/Log-Log4perl-1.43/lib/Log/Log4perl.pm#Changing_the_Log_Level_on_a_Logger gives the example my $v = 0; # default level of verbosity. GetOptions("v+" => \$v, ...); $logger->more_logging($v); # inc logging level once for each -v in ARGV which doesn't work, since in Log::Log4Perl::Logger we have sub more_logging { my ($self) = shift; return $self->dec_level(@_); } sub dec_level { my ($self, $delta) = @_; $delta ||= 1; $self->level(Log::Log4perl::Level::get_lower_level($self->level(), $delta)); $self->set_output_methods; } which means that $logger->more_logging(0) actually decrements the log level by 1.
On Wed Apr 30 16:09:45 2014, nwolff@hearst.com wrote: Show quoted text
> which means that $logger->more_logging(0) actually decrements > the log level by 1.
Yeah, more_logging() indeed defaults to increasing the amount of logging even if the argument passed to it is 0, and changing that would break applications that rely on the old behavior, so I opted for updating the documentation instead: https://github.com/mschilli/log4perl/commit/a6948b31b9524dabbe06775cf1660c9786716aa2 Thanks for reporting this!