cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephan Michels <step...@apache.org>
Subject Re: logging of exceptions was: cvs commit: SourceMultiAction.java
Date Wed, 14 Aug 2002 15:34:32 GMT

On Wed, 14 Aug 2002, Vadim Gritsenko wrote:

> stephan@apache.org wrote:
>
> >               } catch (SourceException se) {
> >  -                getLogger().warn("Exception occurs while storing the content",
se);
> >  -                return null;
> >  +                getLogger().error("Exception occurs while storing the content",
se);
> >  +                throw new ProcessingException("Exception occurs while storing
the content", se);
> >
> Stephan,
>
> Word of advice, if I may. There are two goals in exception handling: one
> is to give relevant information about error to the user (and log file),
> and another is to keep duplication of this information close to 0.
>
> You improved firt, but second is worse now: exception will be logged
> twice (We agreed some time ago that exception will be logged on the
> top-most level). You may want to have some logging here, but I suggest
> to decrease severity level to debug(), and may be to prevent logging
> full stacktrace:
>
>  +          getLogger().debug("Exception occurs while storing the content: " + se);

Thank you for the hint. I used the following combination

For the admin, if he want to be informed (sometimes I need
the complete stacktrace):
if (getLogger().isDebugEnabled())
  getLogger().debug(<message>, exception);


And for the clients:
throw new ProcessingException(<message>, exception);

Do this agree with your conventions?


Stephan Michels.

Ps. sorry for the double post, vadim.


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message