[slf4j-user] Marker for object identification?
Newcomb, Michael-P57487
Michael.Newcomb at gdc4s.com
Wed Feb 7 21:25:29 CET 2007
public class Foo
implements Runnable
{
protected final String name;
protected final Marker marker;
protected final Logger log = LoggerFactory.getLogger(getClass());
public Foo(String name)
{
this.name = name;
marker = MarkerFactory.getMarker(name);
}
public void run()
{
while (true)
{
...
log.debug(marker, "some stuff");
...
}
}
}
new Thread(new Foo("A")).start();
new Thread(new Foo("B")).start();
So you could see the logs for each Foo ('A' and 'B')...
Also, can Markers be created on the fly by using MarkerFactory.getMarker()? Or does that Marker have to exist in a config file somewhere... (e.g. what does LogBack do?)
Thanks,
Michael
-----Original Message-----
From: user-bounces at slf4j.org [mailto:user-bounces at slf4j.org] On Behalf Of Ceki Gülcü
Sent: Wednesday, February 07, 2007 3:14 PM
To: user at slf4j.org
Subject: Re: [slf4j-user] Marker for object identification?
Hi Michael,
I don't fully understand your question. However, you can use a marker to color a log request so that it triggers some particular treatment. Does this help?
At 09:10 PM 2/7/2007, Newcomb, Michael-P57487 wrote:
>Can/Should markers be used to identify specific objects? The only
>example I see is for use with the 'TRACE' marker, but was wondering if
>markers could/should be used object identification as well.
>
>Thanks,
>Michael
>_______________________________________________
>user mailing list
>user at slf4j.org
>http://www.slf4j.org/mailman/listinfo/user
--
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch
_______________________________________________
user mailing list
user at slf4j.org
http://www.slf4j.org/mailman/listinfo/user
More information about the slf4j-user
mailing list