From: Mike S. <msc...@ao...> - 2004-01-27 17:14:32
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title></title> </head> <body> <font face="Arial,sans-serif"><font size="2"><span type="cite">Simon Taylor wrote on 1/26/2004, 12:28 PM:</span> </font></font> <p><font face="Arial,sans-serif" size="2"></font></p> <blockquote type="cite" style="border-left: thin solid blue; padding-left: 10px; margin-left: 0pt;"><font face="Arial,sans-serif" size="2"></font><font face="Arial,sans-serif" size="2"> </font><font face="Arial,sans-serif" size="2"></font><font face="Arial,sans-serif" size="2"> </font> <p><font size="2" face="Arial">I have code wrapped within a try catch block.</font><font size="2" face="Arial"><br> The logger instead of using the surrounding method/function name use ANON when printing with the layout [%d][%p] (%C) %M %m%n.<br> I guess this is because it is the closest control structure to the call.</font><font face="Arial,sans-serif" size="2"> <br> </font><font size="2" face="Arial">If this is the case and the stack is:-</font><font face="Arial,sans-serif" size="2"> <br> </font><font size="2" face="Arial">package</font><font face="Arial,sans-serif" size="2"> <br> </font><font size="2" face="Arial"> method_a</font><font face="Arial,sans-serif" size="2"> <br> </font><font size="2" face="Arial"> try</font><font face="Arial,sans-serif" size="2"> <br> </font><font size="2" face="Arial"> logger_call</font><font size="2" face="Arial"><br> I get logger messages <a class="moz-txt-link-freetext" href="package::anon">package::anon</a>.</font></p> </blockquote> <font size="2"><font face="Arial,sans-serif">I'm assuming you're using the Error.pm package -- the problem with this is, as you've outlined above, that try/catch aren't perl constructs but function calls introducing additional levels (one function, one eval) into the call stack. Log::Log4perl uses the caller() function internally to determine which subroutine it is called from and will dutifully report that it's within an eval(). I think it makes sense for us to get rid of the ANON, I'm gonna put that on my list. However, in your case it will then report "try" as the calling function (and it is the calling function!) -- and I doubt you're gonna like that. Ideas anyone?</font></font><br> <font face="Arial,sans-serif"><font size="2"><br> <span>-- <br> -- Mike<br> Mike Schilli<br> <a class="moz-txt-link-abbreviated" href="mailto:m...@pe...">m...@pe...</a></span></font></font> </body> </html> |