adoroszlai commented on code in PR #7388:
URL: https://github.com/apache/ozone/pull/7388#discussion_r1829247995


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerStateMachine.java:
##########
@@ -216,7 +217,9 @@ public void notifyConfigurationChanged(long term, long 
index,
     List<RaftProtos.RaftPeerProto> newPeers =
         newRaftConfiguration.getPeersList();
     LOG.info("Received Configuration change notification from Ratis. New Peer" 
+
-        " list:\n{}", newPeers);
+        " list:\n[{}\n]", newPeers.stream().map(peer ->
+            String.format("id: \"%s\"%n address: \"%s\"", 
peer.getId().toStringUtf8(), peer.getAddress()))
+        .collect(Collectors.joining("\n, ")));

Review Comment:
   I would prefer to format the string without newlines.  Log messages split 
into several lines are prone to be mixed up with messages from other threads.
   
   Also, would be nice to move the processing out of the log statement.
   
   ```suggestion
       List<String> formatted = newPeers.stream()
           .map(peer -> String.format("id: \"%s\" address: \"%s\"", 
peer.getId().toStringUtf8(), peer.getAddress()))
           .collect(Collectors.toList());
       LOG.info("Received Configuration change notification from Ratis. New 
Peer list: {}", formatted);
   ```



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to