SLF4J
Last update: 2 Oct 2022
Examples
How to define a logger
private final static Logger logger = LoggerFactory.getLogger(<nome_classe>.class);
private final static XLogger logger = XLoggerFactory.getXLogger(<nome_classe>.class);
How to log to info and debug levels:
logger.info("Message without parameters");
// no need to create an Object array
logger.info("Messaggio with many parameters {} {} {}", arg1, arg2, agr3,...);
Note: avoid using the trace
level. Prefer the debug
level
How to log an exception
Avoid: