This will be easy for your guys!
How do I prevent SLF4J from displaying fully qualified class names (e.g. com.mycompany.mypackage.MyObject) and just output MyObject?
I generally prefer this:
1)
private static final Logger LOGGER = LoggerFactory
.getLogger(MyObject.class);
to this:
2)
private static final Logger LOGGER = LoggerFactory
.getLogger("MyObject");
so that when I refactor/rename MyObject to MyThing the reference gets updated automatically for me.
Yet.. with 1) I get unwieldy output: com.mycompany.mypackage.MyObject
I just need to see MyObject in the log…
Optionally: if you know how to selectively colour output (e.g. \e[0;33m for example) based on log level, that would be great to know.
According to the API for the
SimpleLogger, you could try setting theorg.slf4j.simpleLogger.showShortLogNameproperty of yourLOGGERinstance totrue.From the API: