[jbosscache-dev] Logging exceptions

Manik Surtani manik at jboss.org
Thu Dec 21 20:38:08 EST 2006


Precisely.  If an exception is bubbled up to the point that the stack  
trace is dumped, then this is not proper design but a real,  
unexpected exception.

As Brian suggested, exceptions that are 'expected' (and while this  
smells of bad design initially, could still be valid if these are  
truly infrequent circumstances but need appropriate reaction) would  
probably be also caught by design, and dealt with.

If you are referring to purposefully dumping a stack trace as a part  
of handling this exception, then keep this to DEBUG or below, as this  
*does* freak users out!  :-)

Cheers,
--
Manik Surtani

Lead, JBoss Cache
JBoss, a division of Red Hat

Email: manik at jboss.org
Telephone: +44 7786 702 706
MSN: manik at surtani.org
Yahoo/AIM/Skype: maniksurtani



On 21 Dec 2006, at 19:08, Brian Stansberry wrote:

> 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
>
>
> _______________________________________________
> jbosscache-dev mailing list
> jbosscache-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jbosscache-dev





More information about the jbosscache-dev mailing list