[slf4j-user] Use of Markers : life changing events
Joern Huxhorn
jhuxhorn at googlemail.com
Wed Jun 30 22:57:28 CEST 2010
If all Markers are obtained by MarkerFactory.getMarker then yes, both M1 and M2 would contain M3 since they are actually the same Marker instance.
This can get quite nasty in case of different modules that use markers of the same name differently.
See also ticket 76, esp.
http://bugzilla.slf4j.org/show_bug.cgi?id=76#c8
The solution is to use MarkerFactory.getDetachedMarker. This creates distinct Markers that can be used to create a Marker hierarchy that can be built however you like, without interfering with probably existing other Markers.
HTH & Cheers,
Joern.
On 30.06.2010, at 22:37, Fred wrote:
> I have seen discussions of the proper use of markers in two other threads.
> http://thread.gmane.org/gmane.comp.java.slf4j.user/236/focus=238
> http://thread.gmane.org/gmane.comp.java.slf4j.user/786/focus=787
>
> My question is related to 238 (I believe).
> A logger is identified solely by its name.
> When two logger instances are obtained with the same name it is the same logger.
> Can the same be said for markers?
> If there are two markers (M1 & M2) with the same name in separate threads
> and M2 has a marker (M3) added to it (M2.add(M3))
> does M1 also have a reference to M3?
> Does the addition of M3 happen at a particular time or is it retroactive?
> The same questions but for 'remove' rather than 'add'.
> _______________________________________________
> slf4j-user mailing list
> slf4j-user at qos.ch
> http://qos.ch/mailman/listinfo/slf4j-user
More information about the slf4j-user
mailing list