frankvicky commented on code in PR #18185:
URL: https://github.com/apache/kafka/pull/18185#discussion_r1898917932


##########
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/Loggers.java:
##########
@@ -103,18 +105,16 @@ public synchronized LoggerLevel level(String logger) {
      * @return the levels of all known loggers; may be empty, but never null
      */
     public synchronized Map<String, LoggerLevel> allLevels() {
-        Map<String, LoggerLevel> result = new TreeMap<>();
-
-        currentLoggers().stream()
-                .filter(logger -> !logger.getLevel().equals(Level.OFF))
-                .forEach(logger -> result.put(logger.getName(), 
loggerLevel(logger)));
-
-        org.apache.logging.log4j.Logger root = rootLogger();
-        if (!root.getLevel().equals(Level.OFF)) {
-            result.put(ROOT_LOGGER_NAME, loggerLevel(root));
-        }
-
-        return result;
+        return currentLoggers()
+            .values()
+            .stream()
+            .filter(logger -> !logger.getLevel().equals(Level.OFF))
+            .collect(Collectors.toMap(
+                this::getLoggerName,
+                this::loggerLevel,
+                (existing, replacing) -> replacing,
+                TreeMap::new)

Review Comment:
   It aims to return the loggers in natural order.
   I think we should keep it.



-- 
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: jira-unsubscr...@kafka.apache.org

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

Reply via email to