logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rpo...@apache.org
Subject [44/50] logging-log4j2 git commit: [LOG4J2-1562] SocketAppender memory usage grows unbounded if it cannot connect to a server.
Date Sun, 04 Sep 2016 07:22:32 GMT
[LOG4J2-1562] SocketAppender memory usage grows unbounded if it cannot
connect to a server.

Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/8dd0cb27
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/8dd0cb27
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/8dd0cb27

Branch: refs/heads/LOG4J2-1349-gcfree-threadcontext
Commit: 8dd0cb27bc5a924bd51281821bff89999bd7b869
Parents: 0c4f48a
Author: ggregory <ggregory@apache.org>
Authored: Sun Sep 4 01:55:21 2016 -0400
Committer: ggregory <ggregory@apache.org>
Committed: Sun Sep 4 01:55:21 2016 -0400

----------------------------------------------------------------------
 .../java/org/apache/logging/log4j/core/net/TcpSocketManager.java | 3 ++-
 .../org/apache/logging/log4j/core/util/NullOutputStream.java     | 4 ++++
 src/changes/changes.xml                                          | 3 +++
 3 files changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/8dd0cb27/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TcpSocketManager.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TcpSocketManager.java
b/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TcpSocketManager.java
index 4f7f822..79d5b0f 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TcpSocketManager.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TcpSocketManager.java
@@ -29,6 +29,7 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.CountDownLatch;
 
+import org.apache.commons.io.output.NullOutputStream;
 import org.apache.logging.log4j.core.Layout;
 import org.apache.logging.log4j.core.appender.AppenderLoggingException;
 import org.apache.logging.log4j.core.appender.ManagerFactory;
@@ -308,7 +309,7 @@ public class TcpSocketManager extends AbstractSocketManager {
                         data.connectTimeoutMillis, data.reconnectDelayMillis, data.immediateFail,
data.layout, data.bufferSize);
             } catch (final IOException ex) {
                 LOGGER.error("TcpSocketManager (" + name + ") " + ex, ex);
-                os = new ByteArrayOutputStream();
+                os = NullOutputStream.NULL_OUTPUT_STREAM;
             }
             if (data.reconnectDelayMillis == 0) {
                 return null;

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/8dd0cb27/log4j-core/src/main/java/org/apache/logging/log4j/core/util/NullOutputStream.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/NullOutputStream.java
b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/NullOutputStream.java
index dfbd48d..9382f9d 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/NullOutputStream.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/NullOutputStream.java
@@ -36,6 +36,10 @@ public class NullOutputStream extends OutputStream {
      */
     public static final NullOutputStream NULL_OUTPUT_STREAM = new NullOutputStream();
 
+    private NullOutputStream() {
+        // do nothing
+    }
+    
     /**
      * Does nothing - output to <code>/dev/null</code>.
      * 

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/8dd0cb27/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index f8fef10..3e60cc0 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -24,6 +24,9 @@
   </properties>
   <body>
     <release version="2.7" date="2016-MM-DD" description="GA Release 2.7">
+      <action issue="LOG4J2-1562" dev="ggregory" type="fix">
+        SocketAppender memory usage grows unbounded if it cannot connect to a server.
+      </action>
       <action issue="LOG4J2-1559" dev="ggregory" type="fix" due-to="Andrey Plotkin">
         NPE in Level.isInRange.
       </action>


Mime
View raw message