logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Konstantinos Karadamoglou" <kka...@googlemail.com>
Subject Loggers and Inheritance
Date Tue, 06 Jun 2006 16:48:35 GMT
Hello all,

I have two questions about Loggers and Inheritance. Lets assume that we have
following class inheritance:

public class SuperClazz{
  private Logger log=Logger.getLogger(SuperClazz.class);

  private void method1(){
     log.info("method1 invoked");
  }

}
//------------------------
public class ChildClazz1 extends SuperClazz{
  private Logger log=Logger.getLogger(ChildClazz1.class);

  private void method2(){
     log.info("method2 invoked");
  }

}
//------------------------
public class ChildClazz2 extends SuperClazz{
  private Logger log=Logger.getLogger(ChildClazz2.class);

  private void method3(){
     log.info("method3 invoked");
  }

}

1) if method1 is invoked (somehow) which Logger is used and what the logger
display name will be at the console?

2) How can I enforce method1 to use the logger of the child method?

Thank you in advance, Kostas

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message