Skip to content
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

[ROCKETMQ-6] Use logger for exceptions instead of e.printStackTrace(). #3

Closed
wants to merge 8 commits into from

Conversation

shroman
Copy link
Contributor

@shroman shroman commented Dec 22, 2016

@vongosling
Copy link
Member

@shroman Thanks your PR

Could you abide our PR process(modify your PR subject and mention your jira address in the description), please follow this PR. #5

@shroman
Copy link
Contributor Author

shroman commented Dec 23, 2016

@vongosling sure, but where can I find the description of the process?

Btw, modifying the subject, etc. can be done when you merge.

@shroman shroman changed the title Logging instead of printStack(). Fix for ROCKETMQ-6. [ROCKETMQ-6] Use logger for exceptions instead of e.printStackTrace(). Dec 23, 2016
@shroman
Copy link
Contributor Author

shroman commented Dec 23, 2016

@vongosling I modified as you requested ;) Please have a look.

@shroman shroman force-pushed the ROCKETMQ-6 branch 2 times, most recently from 4114084 to 297d903 Compare December 28, 2016 10:53
@lollipopjin
Copy link
Contributor

@shroman Could you please squash your commits and fix conflicts.

@shroman
Copy link
Contributor Author

shroman commented Dec 29, 2016

@lollipopjin I resolved the conflicts, now you can review.
How about squashing all commits when you merge after reviewing this issue? My concern is -- I merged this to the master, so if I squash, it will be very hard for you to review.

@zhouxinyu
Copy link
Member

Hi, @shroman

About e.printStackTrace(), the error message should log to file surely, but can we keep the e.printStackTrace() if the call stack is in broker start process. IMO, print the error message to stderr will be more visualized, the developers can quick locate the reason why broker start failed.

And I have another question, why this PR prefer to use + to concat string instead of using format string?

@shroman
Copy link
Contributor Author

shroman commented Jan 10, 2017

Hi @zhouxinyu

I am not sure if I understand your 1st point though, but if you are saying about printing to stdout or stderr so that users can find problems with brokers from the command line, for instance, quickly,
I think this can be configured via logger xml configuration, right?

As for the 2nd point, I used + just because I am not sure what is the preferred way for the project -- both + and {} through the project. Shall we make a rule for this in http://rocketmq.apache.org/docs/code-guidelines/?

@lizhanhui
Copy link
Contributor

@shroman Please use parameterized template formatting way. See http://slf4j.org/faq.html section "What is the fastest way of (not) logging?"

@shroman
Copy link
Contributor Author

shroman commented Jan 10, 2017

@lizhanhui Ok. I changed my modifications to parameterized template formatting.

@zhouxinyu If you feel this issue needs more careful logging consideration, I don't mind if you assign this JIRA issue to yourself ;) You are working with the project on the daily basis and can tune it better.
Anyway, I think it's better to move stdout logging to slf4j etc. as much as possible.

@vongosling
Copy link
Member

IMO, we should prefer slf4j or String.format effective format way to log in 4.x :-)

@shroman
Copy link
Contributor Author

shroman commented Jan 11, 2017

@vongosling I completely agree with you

Copy link
Member

@wu-sheng wu-sheng left a comment

Choose a reason for hiding this comment

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

Only one suggestion.

@@ -87,8 +87,8 @@ private RemotingCommand processRequest(final Channel channel, RemotingCommand re

response.setOpaque(request.getOpaque());

if (LOG.isDebugEnabled()) {
LOG.debug("receive PullMessage request command, {}", request);
if (log.isDebugEnabled()) {
Copy link
Member

Choose a reason for hiding this comment

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

log.isDebugEnabled() is not necessary, and do not consistent with other codes log-style.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How is it related to this PR? Please see the title.
That is from the original code, probably you can find ten more small improvements in files I edited but lines I haven't even touched ;)

Copy link
Member

Choose a reason for hiding this comment

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

No related, just think you can change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For this particular place, this can be removed, I agree. But it is good to concenrate the attention on what PR is about.

Copy link
Member

Choose a reason for hiding this comment

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

Agree. Next time, I can bring a new pull request after yours merged.

Copy link
Member

@wu-sheng wu-sheng left a comment

Choose a reason for hiding this comment

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

👏🏻👏🏻💪

@dongeforever
Copy link
Member

@shroman please resolve the conflicts and merge this PR

if (log != null) {
log.info(name + "=" + value);
if (logger != null) {
logger.info(name + "=" + value);
Copy link
Member

Choose a reason for hiding this comment

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

please replace {} with + :-)

@@ -69,10 +69,10 @@ public void shutdown(final boolean interrupt) {
long beginTime = System.currentTimeMillis();
this.thread.join(this.getJointime());
long eclipseTime = System.currentTimeMillis() - beginTime;
STLOG.info("join thread " + this.getServiceName() + " eclipse time(ms) " + eclipseTime + " "
log.info("join thread " + this.getServiceName() + " eclipse time(ms) " + eclipseTime + " "
Copy link
Member

Choose a reason for hiding this comment

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

the same question :-)

@@ -86,7 +86,7 @@ public void stop() {

public void stop(final boolean interrupt) {
this.stopped = true;
STLOG.info("stop thread " + this.getServiceName() + " interrupt " + interrupt);
log.info("stop thread " + this.getServiceName() + " interrupt " + interrupt);
Copy link
Member

Choose a reason for hiding this comment

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

the same

@@ -101,7 +101,7 @@ public void stop(final boolean interrupt) {

public void makeStop() {
this.stopped = true;
STLOG.info("makestop thread " + this.getServiceName());
log.info("makestop thread " + this.getServiceName());
Copy link
Member

Choose a reason for hiding this comment

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

the same

@vongosling
Copy link
Member

any update? or close it :-)

@shroman
Copy link
Contributor Author

shroman commented Jul 4, 2017

Ok, if it's good to merge, I will resolve the conflicts and merge.

@shroman shroman changed the base branch from master to develop July 5, 2017 10:56
@shroman shroman closed this Jul 5, 2017
@shroman
Copy link
Contributor Author

shroman commented Jul 5, 2017

Merged to develop branch.

@coveralls
Copy link

coveralls commented Jul 5, 2017

Coverage Status

Coverage decreased (-12.4%) to 26.315% when pulling 0baccb7 on shroman:ROCKETMQ-6 into 9ad9ad0 on apache:develop.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-12.4%) to 26.315% when pulling 0baccb7 on shroman:ROCKETMQ-6 into 9ad9ad0 on apache:develop.

wlliqipeng pushed a commit that referenced this pull request Mar 11, 2019
JiaMingLiu93 pushed a commit to JiaMingLiu93/rocketmq that referenced this pull request May 28, 2020
duhenglucky pushed a commit that referenced this pull request Jul 11, 2022
lyx2000 added a commit to lyx2000/rocketmq that referenced this pull request Jun 30, 2023
# This is the 1st commit message:

add acl event

Signed-off-by: lyx <1419360299@qq.com>

# This is the commit message apache#2:

add update acl config event

Signed-off-by: lyx <1419360299@qq.com>

# This is the commit message apache#3:

refactor(event): fix rename

Signed-off-by: lyx <1419360299@qq.com>

# This is the commit message apache#4:

refactor(acl): track acl update event

Signed-off-by: lyx <1419360299@qq.com>

# Conflicts:
#	acl/src/main/java/org/apache/rocketmq/acl/plain/PlainPermissionManager.java
pulllock pushed a commit to pulllock/rocketmq that referenced this pull request Oct 19, 2023
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.

None yet

8 participants