Skip to content

[ROCKETMQ-172]log improvement for rocketmq client#90

Closed
Jaskey wants to merge 5 commits into
apache:developfrom
Jaskey:ROCKETMQ-172-log-improvement
Closed

[ROCKETMQ-172]log improvement for rocketmq client#90
Jaskey wants to merge 5 commits into
apache:developfrom
Jaskey:ROCKETMQ-172-log-improvement

Conversation

@Jaskey

@Jaskey Jaskey commented Apr 11, 2017

Copy link
Copy Markdown
Contributor

JIRA: https://issues.apache.org/jira/browse/ROCKETMQ-172?jql=project%20%3D%20ROCKETMQ

This should be a pr which contains many improvement among the client code fragment.

@lizhanhui @shroman @vongosling @zhouxinyu
Please help pointing out more places where log/message should be improved.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.01%) to 31.855% when pulling 633ac28 on Jaskey:ROCKETMQ-172-log-improvement into a8fa05e on apache:develop.

2 similar comments
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.01%) to 31.855% when pulling 633ac28 on Jaskey:ROCKETMQ-172-log-improvement into a8fa05e on apache:develop.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.01%) to 31.855% when pulling 633ac28 on Jaskey:ROCKETMQ-172-log-improvement into a8fa05e on apache:develop.

@vesense

vesense commented Apr 13, 2017

Copy link
Copy Markdown
Member

LGTM

}
} else {
if (!responseFuture.isSendRequestOK()) {
pullCallback.onException(new MQClientException("send request failed", responseFuture.getCause()));

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.

Please replace {} with +

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

But this is not a sl4j 's logging, it's a exception, so direct string is needed.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+2.8%) to 34.664% when pulling 7909245 on Jaskey:ROCKETMQ-172-log-improvement into a8fa05e on apache:develop.

2 similar comments
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+2.8%) to 34.664% when pulling 7909245 on Jaskey:ROCKETMQ-172-log-improvement into a8fa05e on apache:develop.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+2.8%) to 34.664% when pulling 7909245 on Jaskey:ROCKETMQ-172-log-improvement into a8fa05e on apache:develop.

@coveralls

coveralls commented Apr 14, 2017

Copy link
Copy Markdown

Coverage Status

Coverage increased (+2.8%) to 34.604% when pulling c46e4c6 on Jaskey:ROCKETMQ-172-log-improvement into a8fa05e on apache:develop.

} else {
if (!responseFuture.isSendRequestOK()) {
pullCallback.onException(new MQClientException("send request failed", responseFuture.getCause()));
pullCallback.onException(new MQClientException("send request failed to " + addr + ".request: " + request, responseFuture.getCause()));

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.

How about writing it this way?
new MQClientException("send request [" + request+ "] failed to " + addr, responseFuture.getCause())

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.

Or ".request: " -> ". Request: "

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I would modify the typo , your NO2. advice

pullCallback.onException(new MQClientException("send request failed to " + addr + ".request: " + request, responseFuture.getCause()));
} else if (responseFuture.isTimeout()) {
pullCallback.onException(new MQClientException("wait response timeout " + responseFuture.getTimeoutMillis() + "ms",
pullCallback.onException(new MQClientException("wait response from " + addr + " timeout :" + responseFuture.getTimeoutMillis() + "ms" + " request: " + request,

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.

" request: " -> ", request: "


if (update) {
Collections.shuffle(addrs);
log.info("name server address updated. NEW : {} , OLD: {}",addrs,old);

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.

NEW, OLD look ugly to me :)
How about

log.info("name server address updated from [{}] to [{}]", addrs, old);

?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@shroman , but OLD , NEW has been already exists in rocketmq's log. please see ConsumerGroupInfo.java for one sample.

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.

just a suggestion to make it prettier ;)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Perhaps we can post another PR for some logging format, currently I would just retain the current way

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+2.7%) to 34.586% when pulling ec7c8cd on Jaskey:ROCKETMQ-172-log-improvement into a8fa05e on apache:develop.

2 similar comments
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+2.7%) to 34.586% when pulling ec7c8cd on Jaskey:ROCKETMQ-172-log-improvement into a8fa05e on apache:develop.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+2.7%) to 34.586% when pulling ec7c8cd on Jaskey:ROCKETMQ-172-log-improvement into a8fa05e on apache:develop.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+2.7%) to 34.492% when pulling 1e8b575 on Jaskey:ROCKETMQ-172-log-improvement into a8fa05e on apache:develop.

2 similar comments
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+2.7%) to 34.492% when pulling 1e8b575 on Jaskey:ROCKETMQ-172-log-improvement into a8fa05e on apache:develop.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+2.7%) to 34.492% when pulling 1e8b575 on Jaskey:ROCKETMQ-172-log-improvement into a8fa05e on apache:develop.

@Jaskey

Jaskey commented Apr 17, 2017

Copy link
Copy Markdown
Contributor Author

@shroman Please review again

@shroman shroman 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.

+1

@vongosling

Copy link
Copy Markdown
Member

+1

@dongeforever

Copy link
Copy Markdown
Member

LGTM +1

@dongeforever

Copy link
Copy Markdown
Member

@Jaskey This PR has been merged

@Jaskey

Jaskey commented Apr 17, 2017

Copy link
Copy Markdown
Contributor Author

@dongeforever @vongosling @shroman

Thank you guys!

@Jaskey Jaskey closed this Apr 17, 2017
@Jaskey Jaskey deleted the ROCKETMQ-172-log-improvement branch April 17, 2017 12:27
JiaMingLiu93 pushed a commit to JiaMingLiu93/rocketmq that referenced this pull request May 28, 2020
JiaMingLiu93 pushed a commit to JiaMingLiu93/rocketmq that referenced this pull request May 28, 2020
pingww pushed a commit that referenced this pull request Aug 26, 2022
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.

6 participants