ppkarwasz commented on code in PR #3199:
URL: https://github.com/apache/logging-log4j2/pull/3199#discussion_r1837111329
##########
log4j-api/src/main/java/org/apache/logging/log4j/spi/LoggerRegistry.java:
##########
@@ -43,7 +41,7 @@
@NullMarked
public class LoggerRegistry<T extends ExtendedLogger> {
- private final Map<String, Map<MessageFactory, WeakReference<T>>>
loggerRefByMessageFactoryByName = new HashMap<>();
+ private final Map<MessageFactory, Map<String, T>>
loggerByNameByMessageFactory = new WeakHashMap<>();
Review Comment:
The entire `LoggerRegistry` will be freed, when the associated
`LoggerContext` becomes unavailable.
The three lines:
```java
logger = newInstance(this, name, messageFactory);
loggerRegistry.putIfAbsent(name, effectiveMessageFactory, newLogger);
return loggerRegistry.getLogger(name, effectiveMessageFactory);
```
have been in Log4j Core since 2016. These lines should not return `null`.
--
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]