Kyle Weaver created BEAM-10953:
----------------------------------
Summary: Logging placeholder mismatches should be disallowed.
Key: BEAM-10953
URL: https://issues.apache.org/jira/browse/BEAM-10953
Project: Beam
Issue Type: Bug
Components: testing
Reporter: Kyle Weaver
slf4j Logger has overloaded methods for each severity level:
public void warn(String format, Object... arguments);
public void warn(String msg, Throwable t);
These two signatures are often confused:
LOG.warn("foo {}", new Exception("bar"));
This example does not print "foo bar" or anything like one would expect.
Instead, "foo {}" (without any substitution) is printed, and the exception ends
up on the next line. This is especially problematic with Dataflow logging, as
it separates errors from their context.
This pattern can be statically checked in Intellij. We should figure out how to
enable it using our existing static analysis tooling (perhaps errorprone?)
--
This message was sent by Atlassian Jira
(v8.3.4#803005)