Skip to content

[ISSUE #9504] Optimize log printing #9505

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 22 commits into
base: develop
Choose a base branch
from

Conversation

weihubeats
Copy link
Member

weihubeats added 22 commits June 8, 2023 11:36
@weihubeats weihubeats changed the title [Enhancement] Optimize log printing [ISSUE #9504] Optimize log printing Jun 30, 2025
@@ -49,7 +49,7 @@ public Object decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
cmd.setProcessTimer(timer);
return cmd;
} catch (Exception e) {
log.error("decode exception, " + RemotingHelper.parseChannelRemoteAddr(ctx.channel()), e);
log.error("decode exception, remoteAddress: {}" ,RemotingHelper.parseChannelRemoteAddr(ctx.channel()), e);
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO, log.error(String,object,object) ,the third exception will be treated as object which is not intended .

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't understand what you mean. I used {} to replace the first parameter, and the second parameter will be printed out as an exception stack normally.
example

ERROR RocketmqRemoting - decode exception, remoteAddress: 192.168.1.1
java.lang.ArithmeticException: / by zero

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.

2 participants