Incorrect warning "Throwables cannot be used in combination with formatted...
Status: Beta
Brought to you by:
jkellerer
The following leads to a warning in intellij, "Throwables cannot be used in combination with formatted log messages":
public static void main(String[] args) {
String a = null;
try {
a.isEmpty();
} catch (NullPointerException e) {
log.warn("variable is null: {}", "a", e);
}
}
But this actually works fine. The log message comes through with the message "variable is null: a" followed by the stack trace.
This is using slf4j-api 1.7.7 with slf4j-log4j12 1.7.7 and log4j 1.2.17.
Oh, I just realized I can turn this off via "verify throwable in formatted message" options in inspections. Sorry! I can't find the close button on the bug, maybe I don't have permissions for it?
Hi Yuval, thanks for the report, I'll keep it open as I have to review this project anyway once I find the time for it.
Such changes in behavior of updated versions of log frameworks should be handled somehow. (At least there should be presets for newer versions of slf4j that already contain the correct config)