Is it possible to override instance variable of base class in Java. I have this scenario.
class base {
protected static final Logger LOGGER = LoggerFactory.getLogger(base.class);
}
class childA extends base
{
// uses a lot of methods of base but should log childA instead of base
// protected static final Logger LOGGER = LoggerFactory.getLogger(childA.class);
}
class childB extends base
{
//uses a lot of methods of base but should log childB instead of base
// protected static final Logger LOGGER = LoggerFactory.getLogger(childB.class);
}
Is the only solution to solve this, to leave the Logger in base unitinitalised and then pass it in the constructor of the base ??