zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h...@apache.org
Subject zookeeper git commit: ZOOKEEPER-2856: ZooKeeperSaslClient#respondToServer should log exception
Date Thu, 27 Jul 2017 00:24:24 GMT
Repository: zookeeper
Updated Branches:
  refs/heads/master f60928787 -> 41b30a74e


ZOOKEEPER-2856: ZooKeeperSaslClient#respondToServer should log exception

See https://issues.apache.org/jira/browse/ZOOKEEPER-2856 for details.

When upstream like HBase call ZooKeeperSaslClient with security enabled, we sometimes get
error in HBase logs like:
`SASL authentication failed using login context 'Client'.`
This error occures when getting SaslException in ZooKeeperSaslClient#respondToServer :
`catch (SaslException e) {`
                `LOG.error("SASL authentication failed using login context '" +`
                       ` this.getLoginContext() + "'.");`
                `saslState = SaslState.FAILED;`
                `gotLastPacket = true;`
`  }`
This error makes user confused without explicit exception message. So I think we can add exception
message to the log.

The patch uses  parameterized logging to add the exception message to the log.

Author: panyuxuan <panyuxuan@cmss.chinamobile.com>

Reviewers: Michael Han <hanm@apache.org>

Closes #318 from pyx1990/ZOOKEEPER-2856


Project: http://git-wip-us.apache.org/repos/asf/zookeeper/repo
Commit: http://git-wip-us.apache.org/repos/asf/zookeeper/commit/41b30a74
Tree: http://git-wip-us.apache.org/repos/asf/zookeeper/tree/41b30a74
Diff: http://git-wip-us.apache.org/repos/asf/zookeeper/diff/41b30a74

Branch: refs/heads/master
Commit: 41b30a74ec8b33255e99d97a102de53d315c28b3
Parents: f609287
Author: panyuxuan <panyuxuan@cmss.chinamobile.com>
Authored: Wed Jul 26 17:24:20 2017 -0700
Committer: Michael Han <hanm@apache.org>
Committed: Wed Jul 26 17:24:20 2017 -0700

----------------------------------------------------------------------
 src/java/main/org/apache/zookeeper/client/ZooKeeperSaslClient.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zookeeper/blob/41b30a74/src/java/main/org/apache/zookeeper/client/ZooKeeperSaslClient.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/zookeeper/client/ZooKeeperSaslClient.java b/src/java/main/org/apache/zookeeper/client/ZooKeeperSaslClient.java
index 449e7be..f921ca3 100644
--- a/src/java/main/org/apache/zookeeper/client/ZooKeeperSaslClient.java
+++ b/src/java/main/org/apache/zookeeper/client/ZooKeeperSaslClient.java
@@ -361,7 +361,7 @@ public class ZooKeeperSaslClient {
                 }
             } catch (SaslException e) {
                 LOG.error("SASL authentication failed using login context '" +
-                        this.getLoginContext() + "'.");
+                        this.getLoginContext() + "' with exception: {}", e);
                 saslState = SaslState.FAILED;
                 gotLastPacket = true;
             }


Mime
View raw message