[slf4j-user] Marker for object identification?

Ceki Gülcü listid at qos.ch
Fri Feb 9 21:40:09 CET 2007


At 11:12 PM 2/8/2007, Boris Unckel wrote:
>Hi,
>
>Ceki Gülcü wrote:
>>
>>
>>That's a tough one. You could indeed create a marker with a given name,
>>delete it, and then recreate it with the same name. There could be classes
>>or objects referring to the old marker instance. They would be holding a
>>"dangling" reference. The old and new markers would behave the same, and
>>could be used interchangeably, as long as they contained the same children.
>>
>>Anyway, since most markers don't have children, and since deleting a marker
>>is only necessary when creating many markers dynamically, deletion should
>>not cause problems, even if it could be problematic under different
>>circumstances.
>>
>>
>>>
>>>So removing is not the best solution?
>>>
>>
>>
>>I don't know. Do you have anything better in mind? :-)
>Looks quite difficult[1]. As posted before in this thread a solution is 
>needed (if MDC is not the best solution).
>
>One possibility:
>A child marker does not inherit "by reference" but "by value". Would mean:

There is no inheritance in markers, not by reference nor by value. A parent 
marker may regroup a child marker, which might also be included in a 
another marker. (I just realize that markers could be arranged in loops but 
that's a different story.)

>p = Marker.getMarker("Parent");
>c = p.getChild("child");
>Marker.remove(p);
>afterRemoveParent = Marker.getMarker("Parent");
>// afterRemoveParent.equals(p) == true
>afterRemoveChild = afterRemoveParent.getChild("child");
>// afterRemoveChild.equals(c) == true

The value of afterRemoveChild would be null. Again, markers, in contrast to 
loggers, are not arranged in a hierarachy.

>Regards
>Boris
>
>[1] He very much enjoys writing software, altough he is discovering that 
>it is far more difficult than what it might seem initially.

Hehe. :-)


-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch




More information about the slf4j-user mailing list