LoggerFactory.getLogger(ClassName.class) vs LoggerFactory.getLogger(this.getClass().getName())

Late entry!

As I am likely to be searching for this in the future.

There is a way to create copy/paste friendly Logger instances (granted this is almost never a good reason to do something!) by using Java 7’s MethodHandles class.

private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)