Skip Menu |
 

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

Report information
The Basics
Id: 39300
Status: new
Priority: 0/
Queue: Catalyst-Log-Log4perl

People
Owner: Nobody in particular
Requestors: rod.taylor [...] gmail.com
Cc:
AdminCc:

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



Subject: Correct depth controls
Download (untitled) / with headers
text/plain 1.6k
When using Catalyst::Log4perl and a Log4perl in other modules, Catalyst::Log4perl tramples the correct depth assignment. It appears "local" was intended to protect against this, but did not. With the below patch and autoflush enabled (see autoflush patch) this bit of code produces the expected log entries in the correct order with the correct function reported as being the source in both cases. my $logger = Log::Log4perl->get_logger(); sub base : Chained('/') PathPart('lgp') CaptureArgs(0) { my ( $self, $c ) = @_; $logger->debug('START'); $c->log->debug('START a'); $logger->debug('START b'); $c->log->info('START c'); } *** Log4perl.pm.orig_p Mon Sep 15 13:31:52 2008 --- Log4perl.pm Mon Sep 15 13:34:45 2008 *************** *** 84,92 **** my ( $self, @message ) = @_; my ( $package, $filename, $line ) = caller; my $depth = $Log::Log4perl::caller_depth; - unless ( $depth > 0 ) { - $depth = 1; - } my @info = ( $package, $name, $depth, \@message ); if ( $self->{override_cspecs} ) { my %caller; --- 84,89 ---- *************** *** 251,260 **** } } ! local $Log::Log4perl::caller_depth = $depth; ! my $logger = Log::Log4perl->get_logger($package); $logger->$type(@$message); } } --- 248,257 ---- } } ! $Log::Log4perl::caller_depth++; my $logger = Log::Log4perl->get_logger($package); $logger->$type(@$message); + $Log::Log4perl::caller_depth--; } }


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.