[jbosscache-dev] Logging exceptions
Brian Stansberry
brian.stansberry at jboss.com
Thu Dec 21 14:08:38 EST 2006
jbosscache-dev-bounces at lists.jboss.org wrote:
> Hi,
>
> Sometimes I come across a case where a good design principle
> for a flow of control is to raise an exception. Exceptions
> are usually logged and stack trace is dumped. In some of
> these cases exceptions happen due to expected circumstances
> (i.e request to activate region when region is not active)
> and so on. I am getting an impression (maybe a false one)
> that users freak out when the see stack traces and thus I am
> reluctant to raise an Exception in some of these cases and
> make a workaround.
>
> What do you guys do about this problem? Is there a way to
> have a generic catch clause for Exception but somehow
> indicate if stacktrace should be dumped or not to a logger?
> Or should I just forget about this impression (of freaking
> out users) and raise exceptions whenever a good design dictates it?
>
If the exception is raised for a good design purpose, wouldn't that also
mean it should be handled somewhere and not propagate to arbitrary code?
And then proper logging design means it shouldn't be logged anywhere on
the way to wherever it's handled, or at least not at anything above
DEBUG level.
- Brian
More information about the jbosscache-dev
mailing list