From: Ateeq A. <Ate...@ta...> - 2006-10-10 13:36:46
|
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: 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=3DSCALAR(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=3DSCALAR(0x4dd404)', 'XML::LibXML::Element=3DSCALAR(0x4cc748)', '/tmp/fetch') called at fetch.pl line 76 $log->logcroak() was called in main::Download. Using: Log::Log4perl->init(\qq{ log4perl.logger =3D DEBUG, LogFile, Screen log4perl.appender.LogFile =3D Log::Log4perl::Appender::File log4perl.appender.LogFile.filename =3D $LogFile log4perl.appender.LogFile.layout =3D PatternLayout log4perl.appender.LogFile.layout.ConversionPattern =3D %d %M %p %m%n log4perl.appender.Screen =3D Log::Log4perl::Appender::Screen log4perl.appender.Screen.Threshold =3D INFO log4perl.appender.Screen.layout =3D PatternLayout log4perl.appender.Screen.layout.ConversionPattern =3D %M %m%n }); Let me know if you still need sample code. Thanks Ateeq -----Original Message----- From: Mike Schilli [mailto:m...@pe...]=20 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) =3D @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 =3D 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 =3D 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 =3D $Carp::CarpLevel + 1; > > my $msg =3D $self->warning_render(@_); > > > > - my $message =3D Carp::shortmess($msg); > > if ($self->is_fatal()) { > > + my $message =3D 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 =3D $self->warning_render(@_); > > local $Carp::CarpLevel =3D 2; > > > > - my $message =3D Carp::longmess($msg); > > if ($self->is_fatal()) { > > + my $message =3D 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. > =20 The very latest from Talis read the latest news at www.talis.com/news=20 listen to our podcasts www.talis.com/podcasts=20 see us at these events www.talis.com/events=20 join the discussion here www.talis.com/forums=20 join our developer community www.talis.com/tdn=20 and read our blogs www.talis.com/blogs=20 Visit Talis at this year's PLA Conference, 11-13th October 2006. We plan = to showcase new product enhancements and unveil new initiatives.=20 =20 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. |