public static Logger getLogger() { final Throwable t = new Throwable(); final StackTraceElement methodCaller = t.getStackTrace()[1]; final Logger logger
A good alternative is to use (one of) the lombok logs annotations : https://projectlombok.org/features/Log.html
It generate the corresponding log statement with the current class.