carterkozak commented on a change in pull request #278: LOG4J2-2631: 
RoutingAppender PurgePolicy implementations don't remove …
URL: https://github.com/apache/logging-log4j2/pull/278#discussion_r294096681
 
 

 ##########
 File path: 
log4j-core/src/main/java/org/apache/logging/log4j/core/appender/routing/RoutingAppender.java
 ##########
 @@ -224,13 +224,16 @@ public void append(LogEvent event) {
             control.callAppender(event);
         }
 
-        if (purgePolicy != null) {
+        if (purgePolicy != null
+                // LOG4J2-2631: PurgePolicy implementations do not need to be 
aware of appenders that
+                // were not created by this RoutingAppender.
+                && !referencedAppenders.containsKey(key)) {
 
 Review comment:
   This check is a bit odd, I considered another approach where the concurrent 
map uses a value with additional metadata describing whether or not the 
appender is based on a reference. Unfortunately that approach would still 
require two concurrent maps in order to avoid concurrency issues, so I opted 
against it in favor of the containsKey check here.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to