logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rpo...@apache.org
Subject svn commit: r1504297 - in /logging/log4j/log4j2/trunk: core/src/main/java/org/apache/logging/log4j/core/appender/ core/src/main/java/org/apache/logging/log4j/core/appender/rolling/ src/changes/
Date Wed, 17 Jul 2013 21:59:28 GMT
Author: rpopma
Date: Wed Jul 17 21:59:28 2013
New Revision: 1504297

URL: http://svn.apache.org/r1504297
Log:
LOG4J2-311: fixes thread-safe issue in manager classes: access to buffer/stream must be in
synchronized block or method

Modified:
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FastFileManager.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/OutputStreamManager.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManager.java
    logging/log4j/log4j2/trunk/src/changes/changes.xml

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FastFileManager.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FastFileManager.java?rev=1504297&r1=1504296&r2=1504297&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FastFileManager.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FastFileManager.java
Wed Jul 17 21:59:28 2013
@@ -104,7 +104,7 @@ public class FastFileManager extends Out
     }
 
     @Override
-    public void flush() {
+    public synchronized void flush() {
         buffer.flip();
         try {
             randomAccessFile.write(buffer.array(), 0, buffer.limit());
@@ -116,7 +116,7 @@ public class FastFileManager extends Out
     }
 
     @Override
-    public void close() {
+    public synchronized void close() {
         flush();
         try {
             randomAccessFile.close();

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/OutputStreamManager.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/OutputStreamManager.java?rev=1504297&r1=1504296&r2=1504297&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/OutputStreamManager.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/OutputStreamManager.java
Wed Jul 17 21:59:28 2013
@@ -129,7 +129,7 @@ public class OutputStreamManager extends
         write(bytes, 0, bytes.length);
     }
 
-    protected void close() {
+    protected synchronized void close() {
         final OutputStream stream = os; // access volatile field only once per method
         if (stream == System.out || stream == System.err) {
             return;
@@ -144,7 +144,7 @@ public class OutputStreamManager extends
     /**
      * Flush any buffers.
      */
-    public void flush() {
+    public synchronized void flush() {
         try {
             os.flush();
         } catch (final IOException ex) {

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManager.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManager.java?rev=1504297&r1=1504296&r2=1504297&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManager.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManager.java
Wed Jul 17 21:59:28 2013
@@ -99,7 +99,7 @@ public class FastRollingFileManager exte
     }
 
     @Override
-    public void flush() {
+    public synchronized void flush() {
         buffer.flip();
         try {
             randomAccessFile.write(buffer.array(), 0, buffer.limit());
@@ -111,7 +111,7 @@ public class FastRollingFileManager exte
     }
 
     @Override
-    public void close() {
+    public synchronized void close() {
         flush();
         try {
             randomAccessFile.close();

Modified: logging/log4j/log4j2/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/src/changes/changes.xml?rev=1504297&r1=1504296&r2=1504297&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/src/changes/changes.xml (original)
+++ logging/log4j/log4j2/trunk/src/changes/changes.xml Wed Jul 17 21:59:28 2013
@@ -21,6 +21,9 @@
   </properties>
   <body>
     <release version="2.0-beta9" date="soon, very soon" description="Bug fixes and enhancements">
+      <action issue="LOG4J2-311" dev="rpopma" type="fix">
+        Synchronized flush() and close() methods in the XxxFileManager and OutputStreamManager
classes.
+      </action>
       <action issue="LOG4J2-312" dev="ggregory" type="update">
         XML layout improvements (compact vs. pretty, namespace, namespace prefix, root element).
       </action>



Mime
View raw message