[slf4j-dev] [Bug 104] XLogger does not implement Logger

bugzilla-daemon at pixie.qos.ch bugzilla-daemon at pixie.qos.ch
Mon Sep 29 13:16:45 CEST 2008


http://bugzilla.slf4j.org/show_bug.cgi?id=104





--- Comment #4 from Ceki Gulcu <listid at qos.ch>  2008-09-29 13:16:44 ---
(In reply to comment #3)
> It isn't quite as convenient because it isn't created by the factory. You
> always have to do new XLogger(LoggerFactory.getLogger(name));. That, by itself,
> isn't a big deal, although LoggerFactory.getXLogger(name) would be better.

Adding LoggerFactory.getXLogger would force slf4j-api to depend on slf4j-ext
which would not reasonable. How about adding an XLoggerFactory class?

// --- Start XLoggerFactory.java

package org.slf4j.ext;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class XLoggerFactory {

  public static XLogger getLogger(String name) {
    return new XLogger(LoggerFactory.getLogger(name));
  }

  public static XLogger getLogger(Class clazz) {
    return getLogger(clazz.getName());
  }
}

// --- End XLoggerFactory.java

> My real concern is just that it is harder to maintain. If you decide to
> implement what is being asked for in
> http://marc.info/?l=slf4j-dev&m=122242476227014&w=2 then XLogger would also
> have to be modified. I realize that you'd also have to modify the support for
> JUL, Log4j, Logback and SimpleLogger as well, but it seems like a bunch of
> extra work for little benefit. Coding LoggerUtil.enter(logger) just doesn't
> seem that much more complicated than logger.enter();

Since XLogger is part of SLF4J, maintaining it would be part of every release.
You do not need to worry about maintaining XLogger. Moreover, the SLF4J API, in
particular org.slf4j.Logger interface, is unlikely to change in a major way. 

I agree that "XLogger implements Logger" involves more code than
LoggerUtil.enter(logger,...) but I think the former is a bit more convenient to
use.



-- 
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the slf4j-dev mailing list