You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by ck...@apache.org on 2021/06/04 15:31:42 UTC

[logging-log4j2] branch release-2.x updated (be4165e -> 902dffe)

This is an automated email from the ASF dual-hosted git repository.

ckozak pushed a change to branch release-2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git.


    from be4165e  [LOG4J2-3095] Category.setLevel should accept null value.
     new 9a77869  LOG4J2-3103: Make listeners in LoggerContext a CopyOnWriteArrayList (#508)
     new 902dffe  LOG4J2-3103 changelog

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../src/main/java/org/apache/logging/log4j/core/LoggerContext.java    | 4 +---
 src/changes/changes.xml                                               | 3 +++
 2 files changed, 4 insertions(+), 3 deletions(-)

[logging-log4j2] 02/02: LOG4J2-3103 changelog

Posted by ck...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ckozak pushed a commit to branch release-2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git

commit 902dffe71b3cb3e7766a5b6db7951b9f02bcda8c
Author: Carter Kozak <ck...@apache.org>
AuthorDate: Fri Jun 4 11:22:15 2021 -0400

    LOG4J2-3103 changelog
---
 src/changes/changes.xml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 0074c6c..6fede27 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -69,6 +69,9 @@
         Allow a PatternSelector to be specified on GelfLayout.
       </action>
       <!-- FIXES -->
+      <action issue="LOG4J2-3103" dev="ckozak" type="fix" due-to="Mike Glazer">
+        Fix race condition which can result in ConcurrentModificationException on context.stop.
+      </action>
       <action issue="LOG4J2-3092" dev="vy" type="fix" due-to="xmh51">
         Fix JsonWriter memory leaks due to retained excessive buffer growth.
       </action>

[logging-log4j2] 01/02: LOG4J2-3103: Make listeners in LoggerContext a CopyOnWriteArrayList (#508)

Posted by ck...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ckozak pushed a commit to branch release-2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git

commit 9a77869632991e07d623ab405c9736eabdfdfd64
Author: Mike Glazer <mi...@gmail.com>
AuthorDate: Fri Jun 4 08:17:22 2021 -0700

    LOG4J2-3103: Make listeners in LoggerContext a CopyOnWriteArrayList (#508)
    
    This particular case fails quite often in integration tests
    where you have multiple separate threads potentially creating
    and destroying the singleton LoggerContext independently.
    
    Since this is a Listener List, it makes sense to just make
    it a CopyOnWriteArrayList, since the frequency of both
    occurring is going to be roughly equivalent.
    
    Co-authored-by: Mike Glazer <mg...@palantir.com>
---
 .../src/main/java/org/apache/logging/log4j/core/LoggerContext.java    | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
index cdc5f86..5e11e0c 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
@@ -22,9 +22,7 @@ import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
 import java.io.File;
 import java.net.URI;
-import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
 import java.util.Objects;
 import java.util.concurrent.ConcurrentHashMap;
@@ -178,7 +176,7 @@ public class LoggerContext extends AbstractLifeCycle
         if (listeners == null) {
             synchronized(this) {
                 if (listeners == null) {
-                    listeners = Collections.synchronizedList(new ArrayList<LoggerContextShutdownAware>());
+                    listeners = new CopyOnWriteArrayList<LoggerContextShutdownAware>();
                 }
             }
         }