logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <ralph.go...@dslextreme.com>
Subject Re: Confusing handleExceptions vs suppressExceptions vs isExceptionSuppressed
Date Thu, 18 Jul 2013 19:02:39 GMT
Look at AbstractAppender.  You will see that it exposes error methods that Appender implementations
can use.

Ralph


On Jul 18, 2013, at 10:56 AM, Nick Williams wrote:

> Well, as long as the Managers always propagate the error back to the Appender, then it
shouldn't be a problem, right?
> 
> Where is the ErrorHandler supposed to be used? Is it in each Appender, or is it used
in whatever calls all of the Appenders (and, in that case, why wouldn't the use be consistent?)?
> 
> Nick
> 
> On Jul 18, 2013, at 1:07 AM, Ralph Goers wrote:
> 
>> The ErrorHandler is there primarily to avoid endlessly logging the same error message
every time a log event fails in the appender.  Unfortunately, this isn't used consistently
and it is difficult to use from Managers, which is where most of the errors are going to occur.
>> 
>> Ralph
>> 
>> On Jul 17, 2013, at 3:38 PM, Nick Williams wrote:
>> 
>>> Okay. So there are two things we need to think about here:
>>> 
>>> 1) The Appender interface contains a method named isExceptionSuppressed(). I've
never liked that name anyway (the grammar is awkward). Do we want to rename this method? Some
ideas: areExceptionsIgnored(), shouldIgnoreExceptions(), ignoreExceptions().
>>> 
>>> 2) All of the appenders have a suppressExceptions configuration attribute (JSON
or XML). Do we want to rename this attribute? Some ideas: exceptionsIgnored, ignoreExceptions.
>>> 
>>> Also, something I'm not quite sure I understand. How does the isExceptionSuppressed()
method relate to the ErrorHandler interface? What's the purpose for having both?
>>> 
>>> Nick
>>> 
>>> On Jul 17, 2013, at 5:27 PM, Paul Benedict wrote:
>>> 
>>>> Aren't we really just talking about ignoring exceptions? If so, "ignore"
is much better than "suppressing" for the reason I raised.
>>>> 
>>>> 
>>>> On Wed, Jul 17, 2013 at 5:10 PM, Gary Gregory <garydgregory@gmail.com>
wrote:
>>>> On Wed, Jul 17, 2013 at 5:48 PM, Paul Benedict <pbenedict@apache.org>
wrote:
>>>> The phrase "suppressed exception" actually means something specific in the
JDK. Are you okay with using the same terminology?
>>>> http://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html
>>>> 
>>>> This is confusing IMO, we need a better name.
>>>> 
>>>> Gary
>>>>  
>>>> 
>>>> 
>>>> On Wed, Jul 17, 2013 at 4:42 PM, Nick Williams <nicholas@nicholaswilliams.net>
wrote:
>>>> Appender specifies a method, isExceptionSuppressed(), which indicates whether
exceptions thrown while appending events should be suppressed (logged instead of re-thrown).
>>>> 
>>>> AbstractAppender implements this method with a private handleExceptions field
and a handleExceptions constructor argument. isExceptionSuppressed() returns handleExceptions
(so, supposedly, "handle exceptions" means "take care of exceptions instead of the user having
to take care of exceptions").
>>>> 
>>>> Everybody that extends AbstractAppender uses the same handleExceptions constructor
argument. They all define a suppressExceptions XML attribute that is assigned to the handleExceptions
constructor argument in the static plugin factory method.
>>>> 
>>>> This is all very confusing to me. I just realize that I have misunderstood
"handleExceptions" this whole time in the database appenders and have assumed it was the opposite
of isExceptionSuppressed() / suppressExceptions (and, thus, have written incorrect code).
>>>> 
>>>> Does anyone have a problem with me renaming handleExceptions to exceptionSuppressed
(to match the JavaBean isExceptionSuppressed method) to make this less confusing?
>>>> 
>>>> Nick
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>>> 
>>>> 
>>>> 
>>>> 
>>>> -- 
>>>> Cheers,
>>>> Paul
>>>> 
>>>> 
>>>> 
>>>> -- 
>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org 
>>>> Java Persistence with Hibernate, Second Edition
>>>> JUnit in Action, Second Edition
>>>> Spring Batch in Action
>>>> Blog: http://garygregory.wordpress.com 
>>>> Home: http://garygregory.com/
>>>> Tweet! http://twitter.com/GaryGregory
>>>> 
>>>> 
>>>> 
>>>> -- 
>>>> Cheers,
>>>> Paul
>>> 
>> 
> 


Mime
View raw message