Consider and example as below:
public class LoggerTestClass {
private static final Logger LOGGER = Logger.getLogger(LoggerTestClass.class);
}
In above example parameter passed to getLogger
method is hard coded i.e LoggerTestClass.class
Now every time I change the class name I have to change the getLogger
method's parameter.
Any other way which will fetch the class name automatically, for example for non static variable we can add this.getClass()
Aucun commentaire:
Enregistrer un commentaire