From: Ateeq A. <Ate...@ta...> - 2006-10-09 13:39:58
|
The Carp related logcarp/croak/confess/cluck messages log at the wrong caller depth. =20 My quick fudge below, also moved a Carp::longmess into an if statement.as $message doesn't look like it gets used outside. =20 Sorry if the bugs already filed somewhere I didn't know where to look. =20 Regards Ateeq =20 =20 =20 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 @@ =20 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 @@ =20 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(@_); =20 - 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--; } =20 $Log::Log4perl::LOGDIE_MESSAGE_ON_STDERR ?=20 @@ -965,11 +971,13 @@ my $msg =3D $self->warning_render(@_); local $Carp::CarpLevel =3D 2; =20 - 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--; } =20 $Log::Log4perl::LOGDIE_MESSAGE_ON_STDERR ? =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. |