cocoon-dev mailing list archives

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

On Wed, 14 Aug 2002, Vadim Gritsenko wrote:

> wrote:
> >               } catch (SourceException se) {
> >  -                getLogger().warn("Exception occurs while storing the content",
> >  -                return null;
> >  +                getLogger().error("Exception occurs while storing the content",
> >  +                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:
For additional commands, email:

View raw message