You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Gary Gregory <ga...@gmail.com> on 2013/05/29 17:05:03 UTC

DefaultErrorHandler impl

In org.apache.logging.log4j.core.appender.DefaultErrorHandler,
error(String, LogEvent, Throwable) looks the same as error(String,
Throwable)

Is that on purpose or the the LogEvent unused by mistake? Should it be
logged? Should it be saved in the exception?

With the code as is, there seems to be an opportunity for refactoring
common code.
Gary

-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Re: DefaultErrorHandler impl

Posted by Ralph Goers <ra...@dslextreme.com>.
First, we are talking about 6 lines of duplicated code.  That isn't the kind of "opportunity" I spend a lot of time thinking about :-)

I recall writing DefaultErrorHandler fairly quickly - I don't think much thought went into it.  Its primary goal is to try to reduce the number of duplicate error messages that are being logged internally. I'm sure the algorithm could be improved and having access to the LogEvent could help that.

Ralph


On May 29, 2013, at 8:05 AM, Gary Gregory wrote:

> In org.apache.logging.log4j.core.appender.DefaultErrorHandler, error(String, LogEvent, Throwable) looks the same as error(String, Throwable)
> 
> Is that on purpose or the the LogEvent unused by mistake? Should it be logged? Should it be saved in the exception?
> 
> With the code as is, there seems to be an opportunity for refactoring common code.
> 
> Gary
> 
> -- 
> 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