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

Reply via email to