[ 
https://issues.apache.org/jira/browse/BEAM-10953?focusedWorklogId=490474&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-490474
 ]

ASF GitHub Bot logged work on BEAM-10953:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 24/Sep/20 23:56
            Start Date: 24/Sep/20 23:56
    Worklog Time Spent: 10m 
      Work Description: ibzib edited a comment on pull request #12907:
URL: https://github.com/apache/beam/pull/12907#issuecomment-698639060


   - ~The pattern `LOG.info("foo {} {}", bar, exception)` is technically 
correct. But the checker rejects it so I changed these instances to 
`LOG.info(String.format("foo %s", bar), exception)`, which disobeys the below. 
So I'm thinking maybe the best solution is to enable `LOG.info("foo {} {}", 
bar, exception)` upstream (see 
https://github.com/KengoTODA/errorprone-slf4j/issues/45). But then they'd have 
to make a new release of the plugin, and it'd be incompatible with Java 8 
without additional changes...~ Just kidding. `LOG.info("foo {} {}", "bar", new 
Exception("baz"))` prints out `foo bar {}`, then the exception.
   - I disabled the check that the string format must be constant, since we 
disobey that one frequently. 
https://github.com/apache/beam/blob/1574a81e99ebe5d1f087f239d4aadc016073a587/sdks/java/core/src/main/java/org/apache/beam/sdk/util/WindowTracing.java#L30


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 490474)
    Time Spent: 2h 20m  (was: 2h 10m)

> 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
>          Time Spent: 2h 20m
>  Remaining Estimate: 0h
>
> 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 similar checks using our existing static analysis tooling (perhaps 
> errorprone?)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to