logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgo...@apache.org
Subject svn commit: r1591544 - in /logging/log4j/log4j2/trunk: log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ log4j-core/src/test/java/org/apache/logging/log4j/core/layout/ log4j-core/src/test/resources/ src/changes/
Date Thu, 01 May 2014 04:12:40 GMT
Author: rgoers
Date: Thu May  1 04:12:40 2014
New Revision: 1591544

URL: http://svn.apache.org/r1591544
Log:
LOG4J2-542 - Make Throwable transient in ThrowableProxy.

Added:
    logging/log4j/log4j2/trunk/log4j-core/src/test/resources/serializedEvent.dat   (with props)
Modified:
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThrowableProxy.java
    logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/SerializedLayoutTest.java
    logging/log4j/log4j2/trunk/src/changes/changes.xml

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThrowableProxy.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThrowableProxy.java?rev=1591544&r1=1591543&r2=1591544&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThrowableProxy.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThrowableProxy.java
Thu May  1 04:12:40 2014
@@ -46,7 +46,7 @@ public class ThrowableProxy implements S
 
     private final ThrowableProxy proxyCause;
 
-    private final Throwable throwable;
+    private final transient Throwable throwable;
 
     private final String name;
 

Modified: logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/SerializedLayoutTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/SerializedLayoutTest.java?rev=1591544&r1=1591543&r2=1591544&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/SerializedLayoutTest.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/SerializedLayoutTest.java
Thu May  1 04:12:40 2014
@@ -25,6 +25,8 @@ import org.apache.logging.log4j.core.Bas
 import org.apache.logging.log4j.core.LogEvent;
 import org.apache.logging.log4j.core.Logger;
 import org.apache.logging.log4j.core.LoggerContext;
+import org.apache.logging.log4j.core.impl.Log4jLogEvent;
+import org.apache.logging.log4j.message.SimpleMessage;
 import org.apache.logging.log4j.test.appender.ListAppender;
 import org.apache.logging.log4j.core.config.ConfigurationFactory;
 import org.junit.AfterClass;
@@ -32,12 +34,16 @@ import org.junit.BeforeClass;
 import org.junit.Test;
 
 import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.util.List;
 import java.util.Map;
 
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNotNull;
 
 /**
  *
@@ -132,4 +138,27 @@ public class SerializedLayoutTest {
             root.addAppender(app);
         }
     }
+
+    @Test
+    public void testSerialization() throws Exception {
+        final SerializedLayout layout = SerializedLayout.createLayout();
+        final Throwable throwable = new LoggingException("Test");
+        final LogEvent event = new Log4jLogEvent(this.getClass().getName(), null,
+            "org.apache.logging.log4j.core.Logger", Level.INFO, new SimpleMessage("Hello,
world!"), throwable);
+        final byte[] result = layout.toByteArray(event);
+        assertNotNull(result);
+        //FileOutputStream fos = new FileOutputStream("target/serializedEvent.dat");
+        //fos.write(layout.getHeader());
+        //fos.write(result);
+        //fos.close();
+    }
+
+    @Test
+    public void testDeserialization() throws Exception {
+        File file = new File("target/test-classes/serializedEvent.dat");
+        FileInputStream fis = new FileInputStream(file);
+        ObjectInputStream ois = new ObjectInputStream(fis);
+        final LogEvent event = (LogEvent) ois.readObject();
+        assertNotNull(event);
+    }
 }

Added: logging/log4j/log4j2/trunk/log4j-core/src/test/resources/serializedEvent.dat
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/resources/serializedEvent.dat?rev=1591544&view=auto
==============================================================================
Binary file - no diff available.

Propchange: logging/log4j/log4j2/trunk/log4j-core/src/test/resources/serializedEvent.dat
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: logging/log4j/log4j2/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/src/changes/changes.xml?rev=1591544&r1=1591543&r2=1591544&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/src/changes/changes.xml (original)
+++ logging/log4j/log4j2/trunk/src/changes/changes.xml Thu May  1 04:12:40 2014
@@ -21,6 +21,9 @@
   </properties>
   <body>
     <release version="2.0-rc2" date="2014-MM-DD" description="Bug fixes and enhancements">
+      <action issue="LOG4J2-542" dev="rgoers" type="fix">
+        Make Throwable transient in ThrowableProxy.
+      </action>
       <action issue="LOG4J2-617" dev="mattsicker" type="update">
         Update SLF4J to 1.7.7.
       </action>



Mime
View raw message