[Catalyst] Trapping added errors with the correct caller

Alexander Hartmaier alexander.hartmaier at t-systems.at
Tue Oct 16 08:58:39 GMT 2012


On 2012-10-15 18:55, Robert Rothenberg wrote:
> 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.
You mean *your* end action code? You haven't showed it and my crystal
ball is broken.

Does it make a difference for you if the error is logged when it
occurred instead of the end of the request?
My apps normally die on the first error which gets logged. The die error
message includes the filename and line number which is sufficient for me.


*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
T-Systems Austria GesmbH Rennweg 97-99, 1030 Wien
Handelsgericht Wien, FN 79340b
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
Notice: This e-mail contains information that is confidential and may be privileged.
If you are not the intended recipient, please notify the sender and then
delete this e-mail immediately.
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*



More information about the Catalyst mailing list