From: Mike S. <m...@pe...> - 2006-10-10 02:19:24
|
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. > |