Skip to content

[KAFKA-6702]Wrong className in LoggerFactory.getLogger method#4772

Merged
guozhangwang merged 1 commit into
apache:trunkfrom
hejiefang:trunk0326
Mar 29, 2018
Merged

[KAFKA-6702]Wrong className in LoggerFactory.getLogger method#4772
guozhangwang merged 1 commit into
apache:trunkfrom
hejiefang:trunk0326

Conversation

@hejiefang

Copy link
Copy Markdown
Contributor

https://issues.apache.org/jira/browse/KAFKA-6702
[KAFKA-6702]Wrong className in LoggerFactory.getLogger method

@hejiefang

Copy link
Copy Markdown
Contributor Author

Sorry, there is something wrong in my local git, so i push a new commit and delete the old one.
@hachikuji @omkreddy

@omkreddy

Copy link
Copy Markdown
Contributor

LGTM

@hachikuji hachikuji left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. Thanks for the patch!

*/
public class LogAndContinueExceptionHandler implements DeserializationExceptionHandler {
private static final Logger log = LoggerFactory.getLogger(StreamThread.class);
private static final Logger log = LoggerFactory.getLogger(LogAndContinueExceptionHandler.class);

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.

IIRC, using StreamThread is on purpose here (same below). @guozhangwang can you chime in?

If StreamThread is on purpose, we might want to add a comment.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would be helpful to understand the reason as well. The problem with a mismatch is that it's harder to track down the source of a log message and it messes up line numbers when printed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The original motivation is to maintain the information of which thread was hitting this error, but the current implementation does not maintain that any more.. I'm not sure if it was lost somewhere in previous commit or it is never the case. But this is what I've in mind originally:

        final String logPrefix = String.format("stream-thread [%s] ", threadClientId);
        final LogContext logContext = new LogContext(logPrefix);
        final Logger log = logContext.logger(LogAndContinueExceptionHandler.class);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are these classes public? Could we move them into StreamThread?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes they are designed to be public.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see. There may not be a nice way to wire in the thread id from a static context. If we can't get the thread id, I'd suggest accepting the change here so that at least the message points to the right file.

@guozhangwang
guozhangwang merged commit cb7cf7c into apache:trunk Mar 29, 2018
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.

5 participants