Hello community, here is the log from the commit of package perl-Log-Log4perl for openSUSE:Factory checked in at 2011-12-21 10:02:21 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Log-Log4perl (Old) and /work/SRC/openSUSE:Factory/.perl-Log-Log4perl.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Log-Log4perl", Maintainer is "[email protected]" Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Log-Log4perl/perl-Log-Log4perl.changes 2011-09-23 12:37:56.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.perl-Log-Log4perl.new/perl-Log-Log4perl.changes 2011-12-21 10:02:26.000000000 +0100 @@ -1,0 +2,13 @@ +Mon Dec 19 15:41:54 UTC 2011 - [email protected] + +- update to 1.34 + * (ms) InternalDebug now replaces all instances of INTERNAL_DEBUG, + not just the first one. + * (ms) Added test case for get_logger() with a ref() on the actual + object instead of on a static category. Updated docs. + * (ms) %d{e} in PatternLayout now returns epoch seconds + * (ms) [RT#72056] Messages blocked by an appender threshold are no + longer passed on to the L4p::Appender::Buffer as undefined + entries. + +------------------------------------------------------------------- Old: ---- Log-Log4perl-1.33.tar.gz New: ---- Log-Log4perl-1.34.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Log-Log4perl.spec ++++++ --- /var/tmp/diff_new_pack.qKpBLW/_old 2011-12-21 10:02:27.000000000 +0100 +++ /var/tmp/diff_new_pack.qKpBLW/_new 2011-12-21 10:02:27.000000000 +0100 @@ -19,13 +19,13 @@ %bcond_with test Name: perl-Log-Log4perl -Version: 1.33 -Release: 1 -License: GPL+ or Artistic +Version: 1.34 +Release: 0 %define cpan_name Log-Log4perl Summary: Log4j implementation for Perl -Url: http://search.cpan.org/dist/Log-Log4perl/ +License: GPL-1.0+ or Artistic-1.0 Group: Development/Libraries/Perl +Url: http://search.cpan.org/dist/Log-Log4perl/ Source: http://www.cpan.org/authors/id/M/MS/MSCHILLI/%{cpan_name}-%{version}.tar.gz BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ Log-Log4perl-1.33.tar.gz -> Log-Log4perl-1.34.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Log4perl-1.33/Changes new/Log-Log4perl-1.34/Changes --- old/Log-Log4perl-1.33/Changes 2011-06-01 08:51:47.000000000 +0200 +++ new/Log-Log4perl-1.34/Changes 2011-11-05 06:40:01.000000000 +0100 @@ -1,6 +1,16 @@ ################################################## Revision history for Log::Log4perl ################################################## +1.34 (2011/11/04) + * (ms) InternalDebug now replaces all instances of INTERNAL_DEBUG, + not just the first one. + * (ms) Added test case for get_logger() with a ref() on the actual + object instead of on a static category. Updated docs. + * (ms) %d{e} in PatternLayout now returns epoch seconds + * (ms) [RT 72056] Messages blocked by an appender threshold are no + longer passed on to the L4p::Appender::Buffer as undefined + entries. + 1.33 (2011/05/31) * (ms) [RT 67132] Applied patch by Darin McBride to allow for empty syswrite messages in the file appender. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Log4perl-1.33/MANIFEST new/Log-Log4perl-1.34/MANIFEST --- old/Log-Log4perl-1.33/MANIFEST 2011-06-01 08:53:34.000000000 +0200 +++ new/Log-Log4perl-1.34/MANIFEST 2011-11-05 06:42:09.000000000 +0100 @@ -141,6 +141,7 @@ t/061Multiline.t t/062InitHash.t t/063LoggerRemove.t +t/064RealClass.t t/compare.pl t/deeper1.expected t/deeper6.expected diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Log4perl-1.33/META.yml new/Log-Log4perl-1.34/META.yml --- old/Log-Log4perl-1.33/META.yml 2011-06-01 08:53:34.000000000 +0200 +++ new/Log-Log4perl-1.34/META.yml 2011-11-05 06:42:09.000000000 +0100 @@ -1,6 +1,6 @@ --- #YAML:1.0 name: Log-Log4perl -version: 1.33 +version: 1.34 abstract: Log4j implementation for Perl author: - Mike Schilli <[email protected]> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Log4perl-1.33/README new/Log-Log4perl-1.34/README --- old/Log-Log4perl-1.33/README 2011-06-01 08:53:34.000000000 +0200 +++ new/Log-Log4perl-1.34/README 2011-11-05 06:42:08.000000000 +0100 @@ -1,5 +1,5 @@ ###################################################################### - Log::Log4perl 1.33 + Log::Log4perl 1.34 ###################################################################### NAME @@ -491,7 +491,7 @@ Third example: - log4j.rootLogger=debug, stdout, R + log4j.rootLogger=DEBUG, stdout, R log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%5p (%F:%L) - %m%n @@ -844,13 +844,34 @@ object, like in # ... in Bar::new() ... - my $logger = Log::Log4perl::get_logger($class); + my $logger = Log::Log4perl::get_logger( $class ); - This way, you'll make sure the logger logs appropriately, no matter if - the method is inherited or called directly. "new()" always gets the real - class name as an argument and all other methods can determine it via - "ref($self)"), so it shouldn't be a problem to get the right class every - time. + In a method other than the constructor, the class name of the actual + object can be obtained by calling "ref()" on the object reference, so + + package BaseClass; + use Log::Log4perl qw( get_logger ); + + sub new { + bless {}, shift; + } + + sub method { + my( $self ) = @_; + + get_logger( ref $self )->debug( "message" ); + } + + package SubClass; + our @ISA = qw(BaseClass); + + is the recommended pattern to make sure that + + my $sub = SubClass->new(); + $sub->meth(); + + starts logging if the "SubClass" category (and not the "BaseClass" + category has logging enabled at the DEBUG level. Initialize once and only once It's important to realize that Log::Log4perl gets initialized once and diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Log4perl-1.33/lib/Log/Log4perl/Appender/Buffer.pm new/Log-Log4perl-1.34/lib/Log/Log4perl/Appender/Buffer.pm --- old/Log-Log4perl-1.33/lib/Log/Log4perl/Appender/Buffer.pm 2011-05-02 16:48:29.000000000 +0200 +++ new/Log-Log4perl-1.34/lib/Log/Log4perl/Appender/Buffer.pm 2011-11-05 06:40:02.000000000 +0100 @@ -68,8 +68,11 @@ $params{log4p_category}, $params{log4p_level}, \my $cache); - # Save it in the appender's message buffer - push @{ $self->{buffer} }, $cache; + # Save it in the appender's message buffer, but only if + # it hasn't been suppressed by an appender threshold + if( defined $cache ) { + push @{ $self->{buffer} }, $cache; + } $self->flush() if $self->{trigger}->($self, \%params); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Log4perl-1.33/lib/Log/Log4perl/Appender/TestBuffer.pm new/Log-Log4perl-1.34/lib/Log/Log4perl/Appender/TestBuffer.pm --- old/Log-Log4perl-1.33/lib/Log/Log4perl/Appender/TestBuffer.pm 2011-05-02 16:48:29.000000000 +0200 +++ new/Log-Log4perl-1.34/lib/Log/Log4perl/Appender/TestBuffer.pm 2011-11-05 06:40:02.000000000 +0100 @@ -39,6 +39,9 @@ my $self = shift; my %params = @_; + if( !defined $params{level} ) { + die "No level defined in log() call of " . __PACKAGE__; + } $self->{buffer} .= "[$params{level}]: " if $LOG_PRIORITY; $self->{buffer} .= $params{message}; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Log4perl-1.33/lib/Log/Log4perl/DateFormat.pm new/Log-Log4perl-1.34/lib/Log/Log4perl/DateFormat.pm --- old/Log-Log4perl-1.33/lib/Log/Log4perl/DateFormat.pm 2011-05-02 16:48:29.000000000 +0200 +++ new/Log-Log4perl-1.34/lib/Log/Log4perl/DateFormat.pm 2011-11-05 06:40:02.000000000 +0100 @@ -79,7 +79,7 @@ "unmatched single quote in chunk \"$chunk\""; } else { # handle active chunks just like before - $chunk =~ s/(([GyMdhHmsSEDFwWakKzZ])\2*)/$self->rep($1)/ge; + $chunk =~ s/(([GyMdhHmsSEeDFwWakKzZ])\2*)/$self->rep($1)/ge; $fmt .= $chunk; } } @@ -139,6 +139,15 @@ # Always constant return "AD"; +################### +#e - epoch seconds# +################### + } elsif($first eq "e") { + # index (0) irrelevant, but we return time() which + # comes in as 2nd parameter + push @{$self->{stack}}, [0, sub { return $_[1] }]; + return "%d"; + ########## #y - year# ########## @@ -287,7 +296,7 @@ for(@{$self->{stack}}) { my($val, $code) = @$_; if($code) { - push @values, $code->($time[$val]); + push @values, $code->($time[$val], $secs); } else { push @values, $time[$val]; } @@ -333,13 +342,14 @@ C<Log::Log4perl::DateFormat> is a formatter which allows dates to be formatted according to the log4j spec on - http://java.sun.com/j2se/1.5.0/docs/api/java/text/SimpleDateFormat.html + http://download.oracle.com/javase/1.4.2/docs/api/java/text/SimpleDateFormat.html which allows the following placeholders to be recognized and processed: Symbol Meaning Presentation Example ------ ------- ------------ ------- G era designator (Text) AD + e epoch seconds (Number) 1315011604 y year (Number) 1996 M month in year (Text & Number) July & 07 d day in month (Number) 10 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Log4perl-1.33/lib/Log/Log4perl/InternalDebug.pm new/Log-Log4perl-1.34/lib/Log/Log4perl/InternalDebug.pm --- old/Log-Log4perl-1.33/lib/Log/Log4perl/InternalDebug.pm 2011-05-02 16:48:29.000000000 +0200 +++ new/Log-Log4perl-1.34/lib/Log/Log4perl/InternalDebug.pm 2011-11-05 06:40:02.000000000 +0100 @@ -25,7 +25,7 @@ my($tmp_fh, $tmpfile) = tempfile( UNLINK => 1 ); - $text =~ s/_INTERNAL_DEBUG(?!\s*=>)/1/; + $text =~ s/_INTERNAL_DEBUG(?!\s*=>)/1/g; print $tmp_fh $text; seek $tmp_fh, 0, 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Log4perl-1.33/lib/Log/Log4perl/Layout/PatternLayout.pm new/Log-Log4perl-1.34/lib/Log/Log4perl/Layout/PatternLayout.pm --- old/Log-Log4perl-1.33/lib/Log/Log4perl/Layout/PatternLayout.pm 2011-05-02 16:48:29.000000000 +0200 +++ new/Log-Log4perl-1.34/lib/Log/Log4perl/Layout/PatternLayout.pm 2011-11-05 06:40:02.000000000 +0100 @@ -533,6 +533,7 @@ %c Category of the logging event. %C Fully qualified package (or class) name of the caller %d Current date in yyyy/MM/dd hh:mm:ss format + %d{...} Current date in customized format (see below) %F File where the logging event occurred %H Hostname (if Sys::Hostname is available) %l Fully qualified name of the calling method followed by the @@ -634,6 +635,7 @@ E day in week (Text) Tuesday D day in year (Number) 189 a am/pm marker (Text) PM + e epoch seconds (Number) 1315011604 (Text): 4 or more pattern letters--use full form, < 4--use short or abbreviated form if one exists. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Log4perl-1.33/lib/Log/Log4perl.pm new/Log-Log4perl-1.34/lib/Log/Log4perl.pm --- old/Log-Log4perl-1.33/lib/Log/Log4perl.pm 2011-05-22 08:11:49.000000000 +0200 +++ new/Log-Log4perl-1.34/lib/Log/Log4perl.pm 2011-11-05 06:40:13.000000000 +0100 @@ -14,7 +14,7 @@ use Log::Log4perl::Config; use Log::Log4perl::Appender; -our $VERSION = '1.33'; +our $VERSION = '1.34'; # set this to '1' if you're using a wrapper # around Log::Log4perl @@ -1118,7 +1118,7 @@ Third example: - log4j.rootLogger=debug, stdout, R + log4j.rootLogger=DEBUG, stdout, R log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%5p (%F:%L) - %m%n @@ -1490,14 +1490,34 @@ I<actual> class of the object, like in # ... in Bar::new() ... - my $logger = Log::Log4perl::get_logger($class); + my $logger = Log::Log4perl::get_logger( $class ); -This way, you'll make sure the logger logs appropriately, -no matter if the method is inherited or called directly. -C<new()> always gets the -real class name as an argument and all other methods can determine it -via C<ref($self)>), so it shouldn't be a problem to get the right class -every time. +In a method other than the constructor, the class name of the actual +object can be obtained by calling C<ref()> on the object reference, so + + package BaseClass; + use Log::Log4perl qw( get_logger ); + + sub new { + bless {}, shift; + } + + sub method { + my( $self ) = @_; + + get_logger( ref $self )->debug( "message" ); + } + + package SubClass; + our @ISA = qw(BaseClass); + +is the recommended pattern to make sure that + + my $sub = SubClass->new(); + $sub->meth(); + +starts logging if the C<"SubClass"> category +(and not the C<"BaseClass"> category has logging enabled at the DEBUG level. =head2 Initialize once and only once diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Log4perl-1.33/t/003Layout.t new/Log-Log4perl-1.34/t/003Layout.t --- old/Log-Log4perl-1.33/t/003Layout.t 2011-05-02 16:48:29.000000000 +0200 +++ new/Log-Log4perl-1.34/t/003Layout.t 2011-11-05 06:40:03.000000000 +0100 @@ -17,7 +17,7 @@ # change 'tests => 1' to 'tests => last_test_to_print'; ######################### use Test::More; -BEGIN { plan tests => 23 }; +BEGIN { plan tests => 24 }; use Log::Log4perl; use Log::Log4perl::Layout; @@ -91,6 +91,14 @@ $logger->debug("That's the message"); like($app->buffer(), qr{01/1970}); + # epoch format +$app->buffer(""); +$layout = Log::Log4perl::Layout::PatternLayout->new( + { time_function => \&mytimer1 }, "%d{e}> %m"); +$app->layout($layout); +$logger->debug("That's the message"); +like($app->buffer(), qr/^180000/); + ############################################################ # Check SimpleLayout ############################################################ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Log4perl-1.33/t/045Composite.t new/Log-Log4perl-1.34/t/045Composite.t --- old/Log-Log4perl-1.33/t/045Composite.t 2011-05-02 16:48:29.000000000 +0200 +++ new/Log-Log4perl-1.34/t/045Composite.t 2011-11-05 06:40:03.000000000 +0100 @@ -24,7 +24,7 @@ # early Perl versions dont # have it. }else{ - plan tests => 18; + plan tests => 19; } } @@ -327,3 +327,31 @@ qr/meth=main:: Sent from main.*meth=Willy::Wonka::func Sent from func/s, "caller stack from composite appender"; +# [RT 72056] Appender Threshold blocks composite appender + +$conf = qq( + log4perl.category = DEBUG, Composite + + log4perl.appender.Buffer = Log::Log4perl::Appender::TestBuffer + log4perl.appender.Buffer.layout = PatternLayout + log4perl.appender.Buffer.Threshold=INFO + log4perl.appender.Buffer.layout.ConversionPattern=%M %m %n + + # Composite Appender + log4perl.appender.Composite = Log::Log4perl::Appender::Buffer + log4perl.appender.Composite.appender = Buffer + log4perl.appender.Composite.trigger = sub { 0 } + +); + +Log::Log4perl->init(\$conf); + +$buffer = Log::Log4perl::Appender::TestBuffer->by_name("Buffer"); +$logger = get_logger(); +$logger->debug("this will be blocked by the appender threshold"); + +my $composite = Log::Log4perl->appender_by_name("Composite"); +$composite->flush(); + +is $buffer->buffer(), "", + "appender threshold blocks message in composite appender"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Log4perl-1.33/t/064RealClass.t new/Log-Log4perl-1.34/t/064RealClass.t --- old/Log-Log4perl-1.33/t/064RealClass.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Log-Log4perl-1.34/t/064RealClass.t 2011-11-05 06:40:03.000000000 +0100 @@ -0,0 +1,44 @@ +# get_logger($self) in the base class returns a logger for the subclass +# category + +use strict; +use Test::More; +use Log::Log4perl::Appender::TestBuffer; + +plan tests => 1; + +package AppBaseClass; +use Log::Log4perl qw(get_logger :easy); +sub meth { + my( $self ) = @_; + get_logger( ref $self )->warn("in base class"); +} + +package AppSubClass; +our @ISA = qw(AppBaseClass); +use Log::Log4perl qw(get_logger :easy); +sub new { + bless {}, shift; +} + +package main; + +use Log::Log4perl qw(get_logger :easy); + +# $Log::Log4perl::CHATTY_DESTROY_METHODS = 1; + +my $conf = q( +log4perl.category.AppSubClass = WARN, LogBuffer +log4perl.appender.LogBuffer = Log::Log4perl::Appender::TestBuffer +log4perl.appender.LogBuffer.layout = Log::Log4perl::Layout::PatternLayout +log4perl.appender.LogBuffer.layout.ConversionPattern = %m%n +); + +Log::Log4perl::init(\$conf); + +my $buffer = Log::Log4perl::Appender::TestBuffer->by_name("LogBuffer"); + +my $sub = AppSubClass->new(); +$sub->meth(); + +is $buffer->buffer(), "in base class\n", "subclass logger in base class"; -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
