[slf4j-user] Marker for object identification?

Boris Unckel boris.unckel.mlg at gmx.net
Thu Feb 8 21:36:16 CET 2007


Hello,

Ceki Gülcü wrote:
> Response below.
>
> At 10:08 PM 2/7/2007, Newcomb, Michael-P57487 wrote:
>   
>> The use case is you have a IoHandler (mina.apache.org) handling 
>> information for a specific IoSession. Each session is unique but IoHandler 
>> logs like this:
>>
>> log.debug("message received: {}", message);
>>
>> DEBUG [IoHandler] message received: message 1
>>     
> Assuming you can inject the marker information related the session to the 
> components that need to log, the marker approach should be OK as long as 
> the number of markers (hence sessions) is limited. Markers cannot be 
> removed, so they will just sit there until all memory is exhausted.
>
> If on the other hand, you cannot inject the information, MDC is the only 
> way to go.
>
>   
just for my understanding:

Is it necessary that two markers with the same name are the same objects?
Or in other words
Marker a = Marker.getMarker("Boris");
Marker b = Marker.getMarker("Boris");
a.equals(b) == true
==> a == b ?

If a == b is allowed to be false:
The markers could be hold with soft references and the JVM can decide 
whether to garbagecollect them or not.

Regards
Boris





More information about the slf4j-user mailing list