[slf4j-dev] Merging Logger and MarkingLogger
Ceki Gülcü
listid at qos.ch
Thu Jan 26 13:29:07 CET 2006
Hello,
While working on LOGBack, an experimental successor to log4j, it
became apparent that Marker objects bring very significant new
functionality. Given that no existing logging system actually
supported markers may cast doubts on this assertion. In versions of
SLF4J prior to 1.0-beta8, the Logger interface contained support for
Marker objects. In 1.0-beta8, Logger interface was split to Logger and
MarkingLogger interfaces. While this obviously simplifies the Logger
interface, it will also make it harder for users to switch between
logging systems which support markers and those that do not. More
specifically, if there exists two distinct types of SLF4J loggers,
org.slf4j.Logger and org.slf4j.MarkingLogger, then one would write:
1: class MyClass {
2:
3: MarkingLogger logger = MarkingLoggerFactory.getLogger(MyClass.class);
4: static Marker helloMarker = MarkerFactory.getMarker("HELLO");
5:
6: public void sayHello() {
7: System.out.println("Hello.");
8: logger.debug(helloMarker, "Hello");
9: }
10: }
The above code mandates a logging implementation with Marker
support. However, users may wish to retain the possibility to
switch back and forth between implementations with and without marker
support without needing to modify their code each time.
I intend to merge methods in MarkingLogger back into Logger with the
understanding that the bindings for logging systems without marker
support would simply ignore the Marker data (as was the vase prior to
SLF4J 1.0beta8).
Comments?
--
Ceki Gülcü
More information about the slf4j-dev
mailing list