From: Mike S. <m...@pe...> - 2006-10-12 05:45:13
|
On Tue, 10 Oct 2006, Ateeq Altaf wrote: > Sorry I should have given a better description, the problem occurs when > using %M in the appender layout pattern. > Here's a sample of the log output: Ah, got it, fixed in 1.07, thanks! -- Mike Mike Schilli m...@pe... > otter# cat /var/tmp/fetch.log > 2006/10/10 12:02:52 main::Download DEBUG Connecting to hostftp.talis.com > 2006/10/10 12:02:52 main::Download DEBUG Logging in as user staff > 2006/10/10 12:02:52 Log::Log4perl::Logger::logcroak FATAL Can't change > remote directory to /fetch/test1: > 2006/10/10 12:02:52 Log::Log4perl::Logger::logcroak FATAL /fetch/test1: > No such file or directory. > 2006/10/10 12:02:52 Log::Log4perl::Logger::logcroak FATAL at fetch.pl > line 217 > 2006/10/10 12:02:52 Log::Log4perl::Logger::logcroak FATAL > main::Download('XML::LibXML::Element=SCALAR(0x4dd404)', '/tmp/fetch') > called at fetch.pl line 159 > 2006/10/10 12:02:52 Log::Log4perl::Logger::logcroak FATAL > main::ProcessDataset('XML::LibXML::Element=SCALAR(0x4dd404)', > 'XML::LibXML::Element=SCALAR(0x4cc748)', '/tmp/fetch') called at > fetch.pl line 76 > > $log->logcroak() was called in main::Download. > > Using: > > Log::Log4perl->init(\qq{ > log4perl.logger = DEBUG, LogFile, > Screen > log4perl.appender.LogFile = > Log::Log4perl::Appender::File > log4perl.appender.LogFile.filename = $LogFile > log4perl.appender.LogFile.layout = PatternLayout > log4perl.appender.LogFile.layout.ConversionPattern = %d %M > %p %m%n > log4perl.appender.Screen = > Log::Log4perl::Appender::Screen > log4perl.appender.Screen.Threshold = INFO > log4perl.appender.Screen.layout = PatternLayout > log4perl.appender.Screen.layout.ConversionPattern = %M %m%n > }); > > Let me know if you still need sample code. > > Thanks > Ateeq > -----Original Message----- > From: Mike Schilli [mailto:m...@pe...] > Sent: 10 October 2006 03:19 > To: Ateeq Altaf > Cc: log...@li... > Subject: Re: [log4perl-devel] Log::Log4Perl::Logger Carp functions > missing depth adjustment > > On Mon, 9 Oct 2006, Ateeq Altaf wrote: > > > The Carp related logcarp/croak/confess/cluck messages log at the wrong > > caller depth. > > You sure? Please provide a snippet of test code that shows the error. > > Here's a quick test: > > $ test.pl > croak at ./t line 9 > main::foo() called at ./t line 13 > $ test.pl 1 > 2006/10/09 19:09:39 l4pcroak at ./t line 10 > 2006/10/09 19:09:39 main::foo() called at ./t line 13 > l4pcroak at ./t line 10 > main::foo() called at ./t line 13 > > $ cat test.pl > #!/usr/bin/perl -w > > use Log::Log4perl qw(:easy); > use Carp; > Log::Log4perl->easy_init($DEBUG); > > my($l4pcroak) = @ARGV; > > sub foo { > $l4pcroak ? LOGCROAK("l4pcroak") : croak("croak"); > } > > foo(); > > -- Mike > > Mike Schilli > m...@pe... > > > > > > > > > My quick fudge below, also moved a Carp::longmess into an if > > statement.as $message doesn't look like it gets used outside. > > > > > > > > Sorry if the bugs already filed somewhere I didn't know where to look. > > > > > > > > Regards > > > > Ateeq > > > > > > > > > > > > > > > > otter# gdiff -u Logger.pm.orig Logger.pm > > > > --- Logger.pm.orig 2006-07-18 18:52:22.000000000 +0100 > > > > +++ Logger.pm 2006-10-09 14:33:06.032491000 +0100 > > > > @@ -911,9 +911,11 @@ > > > > > > > > if ($self->is_warn()) { > > > > my $message = Carp::longmess($msg); > > > > + $Log::Log4perl::caller_depth++; > > > > foreach (split(/\n/, $message)) { > > > > $self->warn("$_\n"); > > > > } > > > > + $Log::Log4perl::caller_depth--; > > > > Carp::cluck($msg); > > > > } > > > > } > > > > @@ -928,9 +930,11 @@ > > > > > > > > if ($self->is_warn()) { > > > > my $message = Carp::shortmess($msg); > > > > + $Log::Log4perl::caller_depth++; > > > > foreach (split(/\n/, $message)) { > > > > $self->warn("$_\n"); > > > > } > > > > + $Log::Log4perl::caller_depth--; > > > > Carp::carp($msg) if $Log::Log4perl::LOGDIE_MESSAGE_ON_STDERR; > > > > } > > > > } > > > > @@ -945,11 +949,13 @@ > > > > local $Carp::CarpLevel = $Carp::CarpLevel + 1; > > > > my $msg = $self->warning_render(@_); > > > > > > > > - my $message = Carp::shortmess($msg); > > > > if ($self->is_fatal()) { > > > > + my $message = Carp::shortmess($msg); > > > > + $Log::Log4perl::caller_depth++; > > > > foreach (split(/\n/, $message)) { > > > > $self->fatal("$_\n"); > > > > } > > > > + $Log::Log4perl::caller_depth--; > > > > } > > > > > > > > $Log::Log4perl::LOGDIE_MESSAGE_ON_STDERR ? > > > > @@ -965,11 +971,13 @@ > > > > my $msg = $self->warning_render(@_); > > > > local $Carp::CarpLevel = 2; > > > > > > > > - my $message = Carp::longmess($msg); > > > > if ($self->is_fatal()) { > > > > + my $message = Carp::longmess($msg); > > > > + $Log::Log4perl::caller_depth++; > > > > foreach (split(/\n/, $message)) { > > > > $self->fatal("$_\n"); > > > > } > > > > + $Log::Log4perl::caller_depth--; > > > > } > > > > > > > > $Log::Log4perl::LOGDIE_MESSAGE_ON_STDERR ? > > > > The very latest from Talis > > read the latest news at www.talis.com/news > > listen to our podcasts www.talis.com/podcasts > > see us at these events www.talis.com/events > > join the discussion here www.talis.com/forums > > join our developer community www.talis.com/tdn > > and read our blogs www.talis.com/blogs > > Visit Talis at this year's PLA Conference, 11-13th October 2006. We > plan to showcase new product enhancements and unveil new initiatives. > > > > > > > > Any views or personal opinions expressed within this email may not be > those of Talis Information Ltd. The content of this email message and > any files that may be attached are confidential, and for the usage of > the intended recipient only. If you are not the intended recipient, then > please return this message to the sender and delete it. Any use of this > e-mail by an unauthorised recipient is prohibited. > > > > The very latest from Talis > read the latest news at www.talis.com/news > listen to our podcasts www.talis.com/podcasts > see us at these events www.talis.com/events > join the discussion here www.talis.com/forums > join our developer community www.talis.com/tdn > and read our blogs www.talis.com/blogs > Visit Talis at this year's PLA Conference, 11-13th October 2006. We plan to showcase new product enhancements and unveil new initiatives. > > > > Any views or personal opinions expressed within this email may not be those of Talis Information Ltd. The content of this email message and any files that may be attached are confidential, and for the usage of the intended recipient only. If you are not the intended recipient, then please return this message to the sender and delete it. Any use of this e-mail by an unauthorised recipient is prohibited. > |