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


##########
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:
   These 3 lines in `log4j-core` version `2.24.0` **must** work correctly and 
**never** return `null`:
   
   
https://github.com/apache/logging-log4j2/blob/c79ae325f6a21af45526c202f121bfced188613e/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java#L534-L536
   
   Sure, if the `messageFactory` parameter is `null`, then the logger will be 
registered using `ParameterizedMessageFactory.INSTANCE` instead of the real 
one. However, at least, `getLogger(name, messageFactory)` will not return 
`null`, which is what would happen if I register the logger using 
`logger.getMessageFactory()`.



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

Reply via email to