You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@helix.apache.org by GitBox <gi...@apache.org> on 2020/09/09 05:57:31 UTC

[GitHub] [helix] pkuwm commented on a change in pull request #1355: Enhance logging for CallbackHandler and Zkclient

pkuwm commented on a change in pull request #1355:
URL: https://github.com/apache/helix/pull/1355#discussion_r485325108



##########
File path: helix-core/src/main/java/org/apache/helix/manager/zk/CallbackHandler.java
##########
@@ -660,24 +666,31 @@ private void subscribeForChanges(NotificationContext.Type callbackType, String p
           //TODO: avoid calling getChildren for path that does not exist
           if (_changeType == CUSTOMIZED_STATE_ROOT) {
             logger.warn(
-                "Failed to subscribe child/data change on path: {}, listener: {}. Instance "
-                    + "does not support Customized State!", path, _listener);
+                "CallbackHandler {}, Failed to subscribe child/data change on path: {}, listener: {}. Instance "
+                    + "does not support Customized State!", this.toString(), path, _listener);
           } else {
-            logger.warn("Failed to subscribe child/data change. path: {}, listener: {}", path,
-                _listener, e);
+            logger.warn("CallbackHandler {}, Failed to subscribe child/data change. path: {}, listener: {}",
+                this.toString(), path, _listener, e);
           }
         }
       }
     }
 
     long end = System.currentTimeMillis();
-    logger.info("Subscribing to path: {} took: {}", path, (end - start));
+    logger.info("CallbackHandler{}, Subscribing to path: {} took: {}", this.toString(), path, (end - start));
   }
 
   public EventType[] getEventTypes() {
     return (EventType[]) _eventTypes.toArray();
   }
 
+  @Override
+  public String toString() {
+    StringBuilder stringBuilder = new StringBuilder();
+    stringBuilder.append(_uid);
+    return stringBuilder.toString();

Review comment:
       I think a `toString()` would give a comprehensive meaning/description for an object. Here, a `uid` doesn't achieve the purpose. If you just want to log uid, then put uid in log is enough.
   If I override a toString(), I would add more descriptions/fields for this object, eg: "CallbackHandler[uid=xxx, path=xxx, ...]".




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org