logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <garydgreg...@gmail.com>
Subject Multiple Markers vs. Marker multiple inheritance.
Date Tue, 01 Mar 2016 23:24:59 GMT
Hi All:

Is the following an odd-ball use case or a super-niche use case, and should
we do anything about it.

I have a part of our app that throws and logs an exception with the usual:

logger.throwing(new FooException(...));

Elsewhere in this class and in the same method, I have softer errors for
which I log a warning with a a custom marker.

What I really want is to be able to filter out both log events based on
this marker but not other kinds of events, hence the use of Markers.

I cannot say:

logger.throwing(myMarker, new FooException(...));

Our implementation marks throwing() log event (helpfully) with its

I could make my custom marker a child of THROWING_MARKER, but that is
really not semantically correct, is smelly and therefore a nasty hack IMO.

If I had a logger.throwing(Marker, Throwable); API, how would it work?

I would say that LogEvent should hold an array of Markers, not a single one.

What does this sound like to you all? Craziness or a power-user refinement?

Let's only consider throwing() for now before we even think about adding
Logger APIs that take Marker[]s.


E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
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

View raw message