Browse Source

ZOOKEEPER-225. c client should log an info message in zookeeper_init detailing connection parameters. (pat via mahadev)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/zookeeper/trunk@726151 13f79535-47bb-0310-9956-ffa450edef68
Mahadev Konar 16 years ago
parent
commit
b833f9d043
3 changed files with 24 additions and 1 deletions
  1. 3 0
      CHANGES.txt
  2. 10 0
      src/c/src/zookeeper.c
  3. 11 1
      src/java/main/org/apache/zookeeper/ZooKeeper.java

+ 3 - 0
CHANGES.txt

@@ -75,6 +75,9 @@ IMPROVEMENTS:
 
    ZOOKEEPER-230. Improvements to FLE. (Flavio via mahadev)
 
+   ZOOKEEPER-225. c client should log an info message in zookeeper_init
+detailing connection parameters. (pat via mahadev)
+
 Release 3.0.0 - 2008-10-21
 
 Non-backward compatible changes:

+ 10 - 0
src/c/src/zookeeper.c

@@ -487,6 +487,16 @@ zhandle_t *zookeeper_init(const char *host, watcher_fn watcher,
 {
     log_env();
 
+    LOG_INFO(("Initiating client connection, host=%s sessionTimeout=%d watcher=%p"
+          " sessionId=0x%llx sessionPasswd=%s context=%p flags=%d",
+              host,
+              recv_timeout,
+              watcher,
+              clientid->client_id,
+              (clientid->passwd == 0 ? "<null>" : "<hidden>"),
+              context,
+              flags));
+
     int errnosave;
     zhandle_t *zh = calloc(1, sizeof(*zh));
     if (!zh) {

+ 11 - 1
src/java/main/org/apache/zookeeper/ZooKeeper.java

@@ -314,13 +314,16 @@ public class ZooKeeper {
 
     volatile States state;
 
-    protected ClientCnxn cnxn;
+    protected final ClientCnxn cnxn;
 
     /**
      * @see ZooKeeper(String, int, Watcher, long, byte[])
      */
     public ZooKeeper(String host, int sessionTimeout, Watcher watcher)
             throws IOException {
+        LOG.info("Initiating client connection, host=" + host
+                + " sessionTimeout=" + sessionTimeout + " watcher=" + watcher);
+
         watchManager.defaultWatcher = watcher;
         cnxn = new ClientCnxn(host, sessionTimeout, this, watchManager);
     }
@@ -358,6 +361,13 @@ public class ZooKeeper {
      */
     public ZooKeeper(String host, int sessionTimeout, Watcher watcher,
             long sessionId, byte[] sessionPasswd) throws IOException {
+        LOG.info("Initiating client connection, host=" + host
+                + " sessionTimeout=" + sessionTimeout
+                + " watcher=" + watcher
+                + " sessionId=" + sessionId
+                + " sessionPasswd="
+                + (sessionPasswd == null ? "<null>" : "<hidden>"));
+
         watchManager.defaultWatcher = watcher;
         cnxn = new ClientCnxn(host, sessionTimeout, this, watchManager,
                 sessionId, sessionPasswd);