I am implementing an Interface which holds a logging routine. Therefore i want to "cache" the logger inside of the interface.
It looks like this.
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.function.Supplier;
interface ILogger {
public static final Logger logger = LoggerFactory.getLogger(this.getClass().getName());
default void debug() {
// do sth with logger
}
}
But i can't use this in a static method.
How can i store my logger in field, so i do not have to look it up everytime i use the debug method?