logging-log4j2 icon indicating copy to clipboard operation
logging-log4j2 copied to clipboard

Expunge stale loggers in InternalLoggerRegistry on method invocation

Open Suvrat1629 opened this issue 8 months ago • 2 comments

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

Suvrat1629 avatar Feb 19 '25 14:02 Suvrat1629