[Catalyst] Using Log4perl -- setting caller()
Quinn Weaver
quinn at fairpath.com
Wed Jul 4 18:00:13 GMT 2007
On Tue, Jul 03, 2007 at 11:23:43PM -0700, Bill Moseley wrote:
> On Tue, Jul 03, 2007 at 03:14:52PM -0700, Quinn Weaver wrote:
> > > Now, the problem with that is $c->log->warn uses caller() so errors
> > > are reported from that sub, not from where warn was called. So, need
> > > a way to use (IIRC) caller(1) instead in that case.
> >
> > Talked to Bill off-list, and this problem appears to be spurious.
> > That is, the messages are actually reported as coming from the right line,
> > after all.
>
> No, that's something different. Full stack traces look fine.
>
> It's %M and the other formats mentioned in the docs that won't be
> right. The plugin uses caller, so obviously calling $c->log->warn
> will look different than calling warn (when is trapped and then calls
> $c->log->warn as in the code I posted).
>
> Print out %M and call both $c->log->warn and warn() and you will see the
> issue.
Aha, got it.
I think the solution is to manipulate $Log::Log4perl::caller_depth somewhere
within Catalyst::Log::Log4perl.
I'm working on a hacked version of C::L::L anyway, so I will investigate.
I'll try this out tomorrow, or today after the barbecue. :)
--
Quinn Weaver, independent contractor | President, San Francisco Perl Mongers
http://fairpath.com/quinn/resume/ | http://sf.pm.org/
510-520-5217
More information about the Catalyst
mailing list