[Catalyst] Trapping added errors with the correct caller

Robert Rothenberg robrwo at gmail.com
Mon Oct 15 16:55:27 GMT 2012


On 15/10/12 17:49 Alexander Hartmaier wrote:
> On 2012-10-15 18:03, Robert Rothenberg wrote:
>> On 15/10/12 15:21 Alexander Hartmaier wrote:
>>> I recommend to use a logging module like Log::Log4perl::Catalyst and do
>>> all your app logging there.
>> I use Log::Dispatch. (The application is already deployed, and it's not
>> feasible to change it to Log4perl now.)
> If you're already using a logger but the default Catalyst one that's fine.
>>
>> I don't see where in your code you trap calls to $c->error() and log them.
> All log messages are going to your logger object, Log::Dispatch in your
> case, not just errors.
> Just configure Log::Dispatch to do with them what you want it to do (log
> to a separate file, mail them, etc. ).

You don't seem to understand my original question.

The "end" method of the Root controller looks for errors in $c->error() and
logs them, then displays a custom error page.  The problem with doing that
is that it does not say where the error occurred.  So I want to modify
$c->error() to log it every time something is added, which is actually quite
easy.  But I want to use something like Sub::Uplevel so that the logger does
not say the wrapper module triggered the error.




More information about the Catalyst mailing list