Hi Xavier,

Many thanks for your compliment. Would you care to create a bug report asking for an enhancement of the documentation as you describe in your email? You can do so under the logback-site/documentation heading [1].

The logback-demo [2] gives an example of how you could use markers.

In a nut shell, you mark logging request with a marker and those marked request can be filtered accordingly. For example, assume you marked a request as "TRACE" as shown below:

package ch.qos.logback.demo;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.Marker;
import org.slf4j.MarkerFactory;

public class MarkerExample {

  static Marker TRACE_MARKER = MarkerFactory.getMarker("TRACE");
  Logger logger = LoggerFactory.getLogger(MarkerExample .class);

  public void aMethod() {
    logger.info(TRACE_MARKER, "Hello world");
  }

}

You can then instruct a turbo filter to drop requests marked with "TRACE" as follows:

<turboFilter class="ch.qos.logback.classic.turbo.MarkerFilter">
  <Name>TRACE</Name>
   <Marker>TRACE</Marker>
   <OnMatch>DENY</OnMatch>
</turboFilter>

Does the above help?


[1] http://bugzilla.qos.ch/enter_bug.cgi?product=logback-site
[2] http://logback.qos.ch/demo.html


At 10:05 AM 2/3/2007, Xavier Hanin wrote:
Hi All,

I'm new to logback, I've read a good part of the documentation, and first I should said that I'm impressed by the quality of the documentation and the feature rich logging system you provide.

Two things:
Question: I have trouble to understand what is a Marker and what is the use case behind them. Could you give me some insight? Remark: While reading the documentation I had the feeling that MDC was introduced too late. Indeed, you reference MDC the first time in chapter 2 (as far as I can say), without giving even an hint on what it is. Several other chapters reference this concept, but it's only in chapter 7 that I understood what it is. Maybe adding a short introduction to this concept (and the concept of Marker) in chapter 2 would help the reader?

Thanks for your great work!

Xavier
_______________________________________________
Logback-user mailing list
[email protected]
http://qos.ch/mailman/listinfo/logback-user

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

_______________________________________________
Logback-user mailing list
[email protected]
http://qos.ch/mailman/listinfo/logback-user

Reply via email to