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

ZOOKEEPER-3083: Remove some redundant and noisy log lines #561

Closed
wants to merge 3 commits into from

Conversation

enixon
Copy link

@enixon enixon commented Jul 5, 2018

No description provided.

@maoling
Copy link
Member

maoling commented Jul 6, 2018

@enixon It seems that your IDE also makes some noises(grin)

@enixon
Copy link
Author

enixon commented Jul 6, 2018

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"
Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Author

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.

Copy link
Contributor

@anmolnar anmolnar left a 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"
Copy link
Contributor

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

Copy link
Contributor

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"
Copy link
Contributor

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()) {
Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor

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

Copy link
Contributor

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

Copy link
Author

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()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here.

Copy link
Contributor

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.

Copy link
Contributor

@breed breed left a 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"
Copy link
Contributor

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);
Copy link
Contributor

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.

Copy link
Contributor

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).

Copy link
Contributor

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()) {
Copy link
Contributor

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()) {
Copy link
Contributor

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"
Copy link
Contributor

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"
Copy link
Contributor

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.

Copy link
Author

@enixon enixon left a 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"
Copy link
Author

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()) {
Copy link
Author

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.

asfgit pushed a commit that referenced this pull request Jul 19, 2018
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>
@asfgit asfgit closed this in f6bba09 Jul 19, 2018
@hanm
Copy link
Contributor

hanm commented Jul 19, 2018

Jenkins complained about a flaky test. LGTM overall. Committed.

@enixon enixon deleted the ZOOKEEPER-3083 branch July 19, 2018 18:53
RokLenarcic pushed a commit to RokLenarcic/zookeeper that referenced this pull request Sep 3, 2022
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants