[slf4j-dev] [Bug 163] Copy & paste of LoggerFactory.getLogger

bugzilla-daemon at pixie.qos.ch bugzilla-daemon at pixie.qos.ch
Fri Dec 11 08:49:45 CET 2009


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





--- Comment #6 from Ceki Gulcu <listid at qos.ch>  2009-12-11 08:49:44 ---
Hi Joern,

I couldn't quite follow your reasoning but it's early in the morning and I am
badly in need of coffee...

--- file A.java
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class A {
  void foo() {
    Logger logger = LoggerFactory.getLogger(this.getClass());
    logger.info("foo");
  }
}

-- file B.java
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class B extends A {
  void bar() {
    Logger logger = LoggerFactory.getLogger(this.getClass());
    logger.info("bar");
  }
}
--- file Main.java
public class Main {
  public static void main(String[] args) {
    A a = new A();
    a.foo();

    B b = new B();
    b.foo();
    b.bar();
  }
}

Calling java Main, yields
2009-12-11 08:44:22,145  INFO [main] [] A - foo
2009-12-11 08:44:22,160  INFO [main] [] B - foo
2009-12-11 08:44:22,160  INFO [main] [] B - bar
which looks pretty OK to me.

Maybe you meant something else?


-- 
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