-
Notifications
You must be signed in to change notification settings - Fork 7.2k
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
ZOOKEEPER-3083: Remove some redundant and noisy log lines #561
Conversation
@enixon It seems that your IDE also makes some noises(grin) |
Rolling back the unnecessary changes :) The failing test was DisconnectedWatcherTest::testManyChildWatchersAutoReset. It is unrelated to my change and will not repro locally. Retrying with next commit. |
@@ -754,7 +754,7 @@ public void finishSessionInit(ServerCnxn cnxn, boolean valid) { | |||
cnxn.sendBuffer(bb); | |||
|
|||
if (valid) { | |||
LOG.info("Established session 0x" | |||
LOG.debug("Established session 0x" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds pretty useful INFO level log. If we turn it into DEBUG level, are there any other equivalent INFO level logging where we can derive the session establishment details? If not, probably better to leave this as INFO?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd leave this one as INFO too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this should go to debug. if you have thousands of clients that are reconnecting after a leader change the log fills with these. if you are really interested in this line you can add a log4j config that will show it. but this really creates a lot of noise in the log.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The attributes of an established connection don't appear in other INFO logs but remain accessible through jmx and through ServerCnxn::dumpConnectionInfo via 'cons'.
I'd agree with Ben that this is makes parsing the logs hard when the number of client connections is high and that it's better to isolate it via log level so it can be turned off in that scenario or turned on (via debug) if needed for low client-supporting ensembles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the cleanup initiative @enixon .
A few nitpicks from me.
+ cnxn.getRemoteSocketAddress()); | ||
createSession(cnxn, passwd, sessionTimeout); | ||
long id = createSession(cnxn, passwd, sessionTimeout); | ||
LOG.info("Client attempting to establish new session: session = 0x" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like these ones. Would you please use the message formatter of the logging lib? e.g. "... {}... {}", a,b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this also be debug like the other session messages?
@@ -754,7 +754,7 @@ public void finishSessionInit(ServerCnxn cnxn, boolean valid) { | |||
cnxn.sendBuffer(bb); | |||
|
|||
if (valid) { | |||
LOG.info("Established session 0x" | |||
LOG.debug("Established session 0x" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd leave this one as INFO too.
+ request.toString() + " aborting remaining multi ops." | ||
+ " Error Path:" + e.getPath() | ||
+ " Error:" + e.getMessage()); | ||
if (e.code().intValue() > Code.APIERROR.intValue()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean that we don't want to log system errors at all?
Or I might be missing something here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additionally refactoring this one to use message formatter would be nice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one really seems like a debug level to me. the issue is that the client request tried to do something create a node that already exists. these are very normal cases that the client is probably expecting (in the case of leader election, for example). we shouldn't be logging this kind of expected behavior for common operations as INFO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get the point - things will break when they are running at scale :) . I don't have strong opinion holding this as INFO. wondering how others think about this (I mentioned it's info as this log was my good friend before when I debugged some issues...).
BTW for similar use case (large scale of clients) - it looks like all client side related log should be silenced on server side. basically server side just keep server specific loggings on by default (which hopefully does not change regardless of the scale of clients). So all client cnx / session related logs need be silenced...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly.
I'll fix up the format of this log line and the others as well.
+ " Error Path:" + e.getPath() | ||
+ " Error:" + e.getMessage()); | ||
|
||
if (e.code().intValue() > Code.APIERROR.intValue()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i feel the same as above here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have way to much log spam! thanx for doing this!
@@ -754,7 +754,7 @@ public void finishSessionInit(ServerCnxn cnxn, boolean valid) { | |||
cnxn.sendBuffer(bb); | |||
|
|||
if (valid) { | |||
LOG.info("Established session 0x" | |||
LOG.debug("Established session 0x" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this should go to debug. if you have thousands of clients that are reconnecting after a leader change the log fills with these. if you are really interested in this line you can add a log4j config that will show it. but this really creates a lot of noise in the log.
if (LOG.isInfoEnabled()) { | ||
LOG.info("Unregister MBean [{}]", objName); | ||
} | ||
LOG.debug("Unregister MBean [{}]", objName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any idea why this was in an if clause before. i don't think it was needed, but just checking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this sounds an optimization as with the if clause presence, if the log is not enabled the objName is not copied which might help if copying objName is expensive. sounds not a very big deal (and i noticed we have two inconsistent logging style in code base, with or without this if clause, might worth a clean up).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. And this where using log4j message formatter comes important: if one use string.format()
instead and not putting it inside an if block, the string will be formatted every time no matter if the log level is enabled.
+ request.toString() + " aborting remaining multi ops." | ||
+ " Error Path:" + e.getPath() | ||
+ " Error:" + e.getMessage()); | ||
if (e.code().intValue() > Code.APIERROR.intValue()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one really seems like a debug level to me. the issue is that the client request tried to do something create a node that already exists. these are very normal cases that the client is probably expecting (in the case of leader election, for example). we shouldn't be logging this kind of expected behavior for common operations as INFO
+ " Error Path:" + e.getPath() | ||
+ " Error:" + e.getMessage()); | ||
|
||
if (e.code().intValue() > Code.APIERROR.intValue()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i feel the same as above here.
+ cnxn.getRemoteSocketAddress()); | ||
createSession(cnxn, passwd, sessionTimeout); | ||
long id = createSession(cnxn, passwd, sessionTimeout); | ||
LOG.info("Client attempting to establish new session: session = 0x" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this also be debug like the other session messages?
} else { | ||
long clientSessionId = connReq.getSessionId(); | ||
LOG.info("Client attempting to renew session 0x" | ||
LOG.info("Client attempting to renew session: session = 0x" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i feel this should be debug as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for bearing with the delay, I'll make the formatting changes requested.
@@ -754,7 +754,7 @@ public void finishSessionInit(ServerCnxn cnxn, boolean valid) { | |||
cnxn.sendBuffer(bb); | |||
|
|||
if (valid) { | |||
LOG.info("Established session 0x" | |||
LOG.debug("Established session 0x" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The attributes of an established connection don't appear in other INFO logs but remain accessible through jmx and through ServerCnxn::dumpConnectionInfo via 'cons'.
I'd agree with Ben that this is makes parsing the logs hard when the number of client connections is high and that it's better to isolate it via log level so it can be turned off in that scenario or turned on (via debug) if needed for low client-supporting ensembles.
+ request.toString() + " aborting remaining multi ops." | ||
+ " Error Path:" + e.getPath() | ||
+ " Error:" + e.getMessage()); | ||
if (e.code().intValue() > Code.APIERROR.intValue()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly.
I'll fix up the format of this log line and the others as well.
Author: Brian Nixon <nixon@fb.com> Reviewers: Benjamin Reed <breed@apache.org>, Michael Han <hanm@apache.org>, Andor Molnar <andor@cloudera.com>, 毛蛤丝 <maoling199210191@sina.com> Closes #561 from enixon/ZOOKEEPER-3083 (cherry picked from commit f6bba09) Signed-off-by: Michael Han <hanm@apache.org>
Jenkins complained about a flaky test. LGTM overall. Committed. |
Author: Brian Nixon <nixon@fb.com> Reviewers: Benjamin Reed <breed@apache.org>, Michael Han <hanm@apache.org>, Andor Molnar <andor@cloudera.com>, 毛蛤丝 <maoling199210191@sina.com> Closes apache#561 from enixon/ZOOKEEPER-3083
No description provided.