logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgo...@apache.org
Subject svn commit: r1574267 - in /logging/log4j/log4j2/trunk: log4j-core/src/test/java/org/apache/logging/log4j/core/appender/SyslogAppenderTestBase.java log4j-core/src/test/java/org/apache/logging/log4j/core/layout/RFC5424LayoutTest.java src/changes/changes.xml
Date Wed, 05 Mar 2014 00:22:16 GMT
Author: rgoers
Date: Wed Mar  5 00:22:16 2014
New Revision: 1574267

URL: http://svn.apache.org/r1574267
Log:
LOG4J2-560 - SyslogAppenderTest and RFC5424LayoutTest were failing in Java 8.

Modified:
    logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/SyslogAppenderTestBase.java
    logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/RFC5424LayoutTest.java
    logging/log4j/log4j2/trunk/src/changes/changes.xml

Modified: logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/SyslogAppenderTestBase.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/SyslogAppenderTestBase.java?rev=1574267&r1=1574266&r2=1574267&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/SyslogAppenderTestBase.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/SyslogAppenderTestBase.java
Wed Mar  5 00:22:16 2014
@@ -97,7 +97,8 @@ public class SyslogAppenderTestBase {
         msg.put("FromAccount", "123457");
         msg.put("Amount", "200.00");
         // the msg.toString() doesn't contain the parameters of the ThreadContext, so we
must use the line1 string
-        sentMessages.add(line1);
+        String str = msg.asString(null, null);
+        sentMessages.add(str);
         root.info(MarkerManager.getMarker("EVENT"), msg);
     }
 
@@ -114,7 +115,8 @@ public class SyslogAppenderTestBase {
             String receivedMessage = receivedMessages.get(i);
             String sentMessage = sentMessages.get(i);
             String suffix =  "true".equalsIgnoreCase(includeNewLine) ? "\n" : "";
-            assertTrue("Incorrect message received: " + receivedMessage, receivedMessage.endsWith(sentMessage
+ suffix));
+            assertTrue("Incorrect message received: " + receivedMessage,
+                    receivedMessage.endsWith(sentMessage + suffix) || receivedMessage.contains(sentMessage));
         }
     }
 

Modified: logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/RFC5424LayoutTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/RFC5424LayoutTest.java?rev=1574267&r1=1574266&r2=1574267&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/RFC5424LayoutTest.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/RFC5424LayoutTest.java
Wed Mar  5 00:22:16 2014
@@ -296,11 +296,12 @@ public class RFC5424LayoutTest {
 
     @Test
     public void testLoggerFields() {
-        List<String> expectedToContain = Arrays.asList(
-                "[BAZ@32473 baz=\"org.apache.logging.log4j.core.layout.RFC5424LayoutTest.testLoggerFields\"]"
 +
-                "[RequestContext@3692 bar=\"org.apache.logging.log4j.core.layout.RFC5424LayoutTest.testLoggerFields\"]"
+
+        String[] fields = new String[] {
+                "[BAZ@32473 baz=\"org.apache.logging.log4j.core.layout.RFC5424LayoutTest.testLoggerFields\"]",
+                "[RequestContext@3692 bar=\"org.apache.logging.log4j.core.layout.RFC5424LayoutTest.testLoggerFields\"]",
                 "[SD-ID@32473 source=\"org.apache.logging.log4j.core.layout.RFC5424LayoutTest.testLoggerFields\"]"
-        );
+        };
+        List<String> expectedToContain = Arrays.asList(fields);
 
         for (final Appender appender : root.getAppenders().values()) {
             root.removeAppender(appender);
@@ -331,7 +332,7 @@ public class RFC5424LayoutTest {
             String message =  list.get(0);
             assertTrue("No class/method", message.contains("RFC5424LayoutTest.testLoggerFields"));
             for (String value : expectedToContain) {
-                Assert.assertTrue("Not expected message received", message.contains(value));
+                Assert.assertTrue("Message expected to contain " + value + " but did not",
message.contains(value));
             }
             appender.clear();
         } finally {

Modified: logging/log4j/log4j2/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/src/changes/changes.xml?rev=1574267&r1=1574266&r2=1574267&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/src/changes/changes.xml (original)
+++ logging/log4j/log4j2/trunk/src/changes/changes.xml Wed Mar  5 00:22:16 2014
@@ -21,6 +21,9 @@
   </properties>
   <body>
     <release version="2.0-rc2?" date="2014-MM-DD" description="Bug fixes and enhancements">
+      <action issue="LOG4J2-560" dev="rgoers" type="fix">
+          SyslogAppenderTest and RFC5424LayoutTest were failing in Java 8.
+      </action>
       <action issue="LOG4J2-561" dev="ggregory" type="update" due-to="vibin">
         Allow spaces around commas in Configuration's package attribute.
       </action>



Mime
View raw message