You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "Kyle Weaver (Jira)" <ji...@apache.org> on 2020/09/22 22:43:00 UTC

[jira] [Updated] (BEAM-10953) Logging placeholder mismatches should be disallowed.

     [ https://issues.apache.org/jira/browse/BEAM-10953?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kyle Weaver updated BEAM-10953:
-------------------------------
    Description: 
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). This often confuses Dataflow users.

This pattern can be statically checked in Intellij. We should figure out how to enable it using our existing static analysis tooling (perhaps errorprone?)

  was:
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?)


> 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
>            Priority: P2
>
> 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). This often confuses Dataflow users.
> 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)