On Wed, 14 Aug 2002, Vadim Gritsenko wrote:
> [EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]