浏览代码

ZOOKEEPER-2315: Change client connect zk service timeout log level from Info
to Warn level (Lin Yiqun via rgs)

git-svn-id: https://svn.apache.org/repos/asf/zookeeper/trunk@1713312 13f79535-47bb-0310-9956-ffa450edef68

Raúl Gutiérrez Segalés 9 年之前
父节点
当前提交
0285b134ee
共有 2 个文件被更改,包括 17 次插入8 次删除
  1. 3 0
      CHANGES.txt
  2. 14 8
      src/java/main/org/apache/zookeeper/ClientCnxn.java

+ 3 - 0
CHANGES.txt

@@ -297,6 +297,9 @@ IMPROVEMENTS:
   ZOOKEEPER-2040: Server to log underlying cause of SASL connection problems.
   (Steve Loughran via cnauroth)
 
+  ZOOKEEPER-2315: Change client connect zk service timeout log level from Info
+  to Warn level (Lin Yiqun via rgs)
+
 Release 3.5.0 - 8/4/2014
 
 NEW FEATURES:

+ 14 - 8
src/java/main/org/apache/zookeeper/ClientCnxn.java

@@ -1197,11 +1197,14 @@ public class ClientCnxn {
                     }
                     
                     if (to <= 0) {
-                        throw new SessionTimeoutException(
-                                "Client session timed out, have not heard from server in "
-                                        + clientCnxnSocket.getIdleRecv() + "ms"
-                                        + " for sessionid 0x"
-                                        + Long.toHexString(sessionId));
+                        String warnInfo;
+                        warnInfo = "Client session timed out, have not heard from server in "
+                            + clientCnxnSocket.getIdleRecv()
+                            + "ms"
+                            + " for sessionid 0x"
+                            + Long.toHexString(sessionId);
+                        LOG.warn(warnInfo);
+                        throw new SessionTimeoutException(warnInfo);
                     }
                     if (state.isConnected()) {
                     	//1000(1 second) is to prevent race condition missing to send the second ping
@@ -1382,9 +1385,12 @@ public class ClientCnxn {
                         Watcher.Event.EventType.None,
                         Watcher.Event.KeeperState.Expired, null));
                 eventThread.queueEventOfDeath();
-                throw new SessionExpiredException(
-                        "Unable to reconnect to ZooKeeper service, session 0x"
-                                + Long.toHexString(sessionId) + " has expired");
+
+                String warnInfo;
+                warnInfo = "Unable to reconnect to ZooKeeper service, session 0x"
+                    + Long.toHexString(sessionId) + " has expired";
+                LOG.warn(warnInfo);
+                throw new SessionExpiredException(warnInfo);
             }
             if (!readOnly && isRO) {
                 LOG.error("Read/write client got connected to read-only server");