Skip to content

MINOR: Fix log format in AbstractCoordinator#10247

Closed
dengziming wants to merge 1 commit intoapache:trunkfrom
dengziming:minor-log-format
Closed

MINOR: Fix log format in AbstractCoordinator#10247
dengziming wants to merge 1 commit intoapache:trunkfrom
dengziming:minor-log-format

Conversation

@dengziming
Copy link
Copy Markdown
Member

@dengziming dengziming commented Mar 2, 2021

More detailed description of your change
Accidentally saw a log:

[2021-03-02 20:39:56,418] DEBUG FindCoordinator request failed due to {} (org.apache.kafka.clients.consumer.internals.AbstractCoordinatorTest$DummyCoordinator:863)
org.apache.kafka.common.errors.AuthenticationException: Authentication failed

I fixed it to:

[2021-03-02 20:51:39,050] DEBUG FindCoordinator request failed due to Authentication failed (org.apache.kafka.clients.consumer.internals.AbstractCoordinatorTest$DummyCoordinator:863)

I think the author wants to call Logger.debug(String format, Object arg), but called Logger.debug(String msg, Throwable t). In fact, there are 5 overloadings Logger.debug() so we need to be careful.

Summary of testing strategy (including rationale)
test locally

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

@dengziming dengziming changed the title MINOR: Fix log format MINOR: Fix log format in AbstractCoordinator Mar 2, 2021
@dengziming
Copy link
Copy Markdown
Member Author

@ableegoldman , Hi, PTAL.

Copy link
Copy Markdown
Member

@chia7712 chia7712 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dengziming Thanks for your patch. LGTM

Copy link
Copy Markdown
Member

@chia7712 chia7712 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dengziming Sorry that I have some comments when making another look.

Could you fix another similar issue (see https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/security/kerberos/KerberosError.java#L100)?

@Override
public void onFailure(RuntimeException e, RequestFuture<Void> future) {
log.debug("FindCoordinator request failed due to {}", e);
log.debug("FindCoordinator request failed due to {}", e.getMessage());
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about using e.toString()? It shows the class name of exception. I feel it is useful also.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not clear what was intended here. Is the stacktrace useful or not? If the {} is removed, then the stacktrace would be printed. If we make the change in this PR, we don't include the stacktrace. @hachikuji Thoughts since you have done a lot of coordinator debugging?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@guozhangwang has a PR open in which he fixes this on the side. See https://github.com/apache/kafka/pull/10232/files#r584478802

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, the #10232 LGTM, will close this pr.

@dengziming
Copy link
Copy Markdown
Member Author

dengziming commented Mar 2, 2021

@chia7712 Thank you,There are 5 overloadings of log.debug, the code in your comment isn't the same with mine, WDYT?

@dengziming dengziming closed this Mar 3, 2021
@dengziming dengziming deleted the minor-log-format branch March 25, 2022 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants