When using a logger as error handling, setting the exception as the cause of the log statement will provide more context in the log message.
Instead of:
try {
...
} catch (Exception e) {
logger.atWarning().log("Failed!");
}
Consider:
try {
...
} catch (Exception e) {
logger.atWarning().withCause(e).log("Failed!");
}
Suppress false positives by adding the suppression annotation @SuppressWarnings("FloggerLogWithCause") to the enclosing element.