ppkarwasz commented on code in PR #3209:
URL: https://github.com/apache/logging-log4j2/pull/3209#discussion_r1846161689


##########
log4j-api/src/main/java/org/apache/logging/log4j/spi/LoggerRegistry.java:
##########
@@ -243,32 +232,30 @@ public boolean hasLogger(final String name, final Class<? 
extends MessageFactory
      * Registers the provided logger.
      * <b>Logger name and message factory parameters are ignored</b>, those 
will be obtained from the logger instead.
      *
-     * @param name ignored – kept for backward compatibility
-     * @param messageFactory ignored – kept for backward compatibility
+     * @param name a logger name

Review Comment:
   There are two main reasons:
   
   1. We want to make sure that `getLogger(name, mf)` returns the object that 
was inserted using `putIfAbsent(name, mf, logger)`. This way `getLogger` will 
not return `null` even if `(name, mf)` is different from `(logger.getName(), 
logger.getMessageFactory())`.
   2. I want to use the `messageFactory` argument, so it does not become 
unreachable. This is not a very important argument, since `messageFactory` 
might become unreachable right after the `putIfAbsent` method call.



-- 
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: notifications-unsubscr...@logging.apache.org

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

Reply via email to