logging-log4j2
logging-log4j2 copied to clipboard
Expunge stale loggers in InternalLoggerRegistry on method invocation
This PR updates InternalLoggerRegistry to automatically remove stale loggers when its methods are invoked. Changes Introduced: Introduced a ReferenceQueue<Logger> to track loggers that have been reclaimed by the garbage collector. Implemented expungeStaleEntries(), which removes stale loggers before executing registry operations. Updated methods like getLogger() and computeIfAbsent() to invoke expungeStaleEntries() before proceeding. Added tests to verify stale loggers are expunged without relying on private methods.
Fixes #3430