W
WJ
I'm creating a new project and want to create some base classes to provide
common functions to all classes extending it. One thing I'd like to do it
have the LogFactory available in every class.
So I'd want something like this:
public abstract class BaseClass {
protected static final Log log = LogFactory.getLog(this.class);
}
public class Class1 extends BaseClass {
//I have reference to the logger from the super class
log.debug("some statement);
}
But, as you know, I can't use this.class in the .getLog function in the Base
class. Is there a way to do this? I want the debug statement to show that
the debug came from Class1, not the BaseClass.
Thanks!
common functions to all classes extending it. One thing I'd like to do it
have the LogFactory available in every class.
So I'd want something like this:
public abstract class BaseClass {
protected static final Log log = LogFactory.getLog(this.class);
}
public class Class1 extends BaseClass {
//I have reference to the logger from the super class
log.debug("some statement);
}
But, as you know, I can't use this.class in the .getLog function in the Base
class. Is there a way to do this? I want the debug statement to show that
the debug came from Class1, not the BaseClass.
Thanks!