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


##########
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/Loggers.java:
##########
@@ -148,18 +159,21 @@ public synchronized List<String> setLevel(String 
namespace, Level level) {
      * @return all loggers that fall under the given namespace; never null, 
and will always contain
      * at least one logger (the ancestor logger for the namespace)
      */
-    private synchronized List<org.apache.logging.log4j.Logger> loggers(String 
namespace) {
+    private synchronized Collection<org.apache.logging.log4j.Logger> 
loggers(String namespace) {
         Objects.requireNonNull(namespace, "Logging namespace may not be null");
 
-        if (ROOT_LOGGER_NAME.equalsIgnoreCase(namespace)) {
-            List<org.apache.logging.log4j.Logger> result = currentLoggers();
-            result.add(rootLogger());
-            return result;
+        if (isValidRootLoggerName(namespace)) {
+            return currentLoggers().values();
         }
 
-        List<org.apache.logging.log4j.Logger> result = new ArrayList<>();
-        org.apache.logging.log4j.Logger ancestorLogger = 
lookupLogger(namespace);
-        List<org.apache.logging.log4j.Logger> currentLoggers = 
currentLoggers();
+        var result = new ArrayList<org.apache.logging.log4j.Logger>();
+        var nameToLogger = currentLoggers();
+        var ancestorLogger = nameToLogger.entrySet().stream()

Review Comment:
   why not calling `lookupLogger` directly?



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