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


##########
log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java:
##########
@@ -526,23 +527,22 @@ public Collection<Logger> getLoggers() {
     public Logger getLogger(final String name, final MessageFactory 
messageFactory) {
         final MessageFactory effectiveMessageFactory =
                 messageFactory != null ? messageFactory : 
DEFAULT_MESSAGE_FACTORY;
-        final Logger oldLogger = loggerRegistry.getLogger(name, 
effectiveMessageFactory);
-        if (oldLogger != null) {
-            return oldLogger;
-        }
-        final Logger newLogger = newInstance(name, effectiveMessageFactory);
-        loggerRegistry.putIfAbsent(name, effectiveMessageFactory, newLogger);
-        return loggerRegistry.getLogger(name, effectiveMessageFactory);
+        return loggerRegistry.computeIfAbsent(name, effectiveMessageFactory, 
this::newInstance);
     }
 
     /**
      * Gets the LoggerRegistry.
      *
      * @return the LoggerRegistry.
      * @since 2.17.2
+     * @deprecated since 2.25.0 without a replacement.

Review Comment:
   Nice catch! Since we can only deprecate on minor version bumps, I removed 
the deprecation in 
https://github.com/apache/logging-log4j2/pull/3209/commits/c3e466f3d147724983c668c1097a297523252e4c



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