logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Williams <nicho...@nicholaswilliams.net>
Subject Re: Confusing handleExceptions vs suppressExceptions vs isExceptionSuppressed
Date Wed, 17 Jul 2013 21:57:31 GMT
I think it's pretty clear here that Log4j suppressing appender exceptions and JDK Suppressed
Exceptions are not the same thing. I don't think it's something that we need to worry about,
and changing the name to something else (what?) would require a much bigger refactor (and
would be an API-altering, breaking change).

My only desire here is to use the same term everywhere ("suppress" instead of "handle") so
that it's not so confusing. Renaming the "handleExceptions" field/constructor argument to
"exceptionSuppressed" (to match the JavaBean isExceptionSuppressed() method that it's returned
from) or "suppressException"s (to match the XML attribute) are both acceptable to me.


On Jul 17, 2013, at 4:48 PM, Paul Benedict 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
> On Wed, Jul 17, 2013 at 4:42 PM, Nick Williams <nicholas@nicholaswilliams.net>
> 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

View raw message