January 2018
Intermediate to advanced
350 pages
9h 7m
English
The most important thing about a log message is its level. It is the information allowing you to efficiently ignore the messages - and their formatting/templating - if they will be ignored later anyway.
For instance, take this method that relies on loggers at different levels:
public void save(long id, Quote quote) { logger.finest("Value: " + quote); String hexValue = converter.toHexString(id); doSave(id, quote); logger.info("Saved: " + hexValue); logger.finest("Id: " + hexValue + ", quote=" + quote);}
This method is mixing debug and info log messages. Nevertheless, it is very likely that the debug messages will not be activated in production, but info messages will be if you use the info level as optional messages, then ...
Read now
Unlock full access