You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rg...@apache.org on 2018/12/03 04:22:01 UTC
[logging-log4j2] branch release-2.x updated: LOG4J2-1906 - Add more
output if a test failure occurs
This is an automated email from the ASF dual-hosted git repository.
rgoers pushed a commit to branch release-2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
The following commit(s) were added to refs/heads/release-2.x by this push:
new 9d14aa3 LOG4J2-1906 - Add more output if a test failure occurs
9d14aa3 is described below
commit 9d14aa37e8c1a0c7ee5fa780a794e6ca04a72c95
Author: Ralph Goers <rg...@apache.org>
AuthorDate: Sun Dec 2 21:21:50 2018 -0700
LOG4J2-1906 - Add more output if a test failure occurs
---
.../rolling/RollingAppenderDirectWrite1906Test.java | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderDirectWrite1906Test.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderDirectWrite1906Test.java
index c2b7c59..61fcf40 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderDirectWrite1906Test.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderDirectWrite1906Test.java
@@ -19,9 +19,12 @@ package org.apache.logging.log4j.core.appender.rolling;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
+import java.util.List;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.junit.LoggerContextRule;
+import org.apache.logging.log4j.status.StatusData;
+import org.apache.logging.log4j.status.StatusLogger;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -80,7 +83,7 @@ public class RollingAppenderDirectWrite1906Test {
String[] parts = line.split((" "));
String expected = "rollingfile." + parts[0] + ".log";
- assertEquals("Incorrect file name. Expected: " + expected + " Actual: " + actual, expected, actual);
+ assertEquals(logFileNameError(expected, actual), expected, actual);
++found;
}
reader.close();
@@ -88,4 +91,12 @@ public class RollingAppenderDirectWrite1906Test {
assertEquals("Incorrect number of events read. Expected " + count + ", Actual " + found, count, found);
}
+
+ private String logFileNameError(String expected, String actual) {
+ List<StatusData> statusData = StatusLogger.getLogger().getStatusData();
+ for (StatusData statusItem : statusData) {
+ System.err.println(statusItem.getFormattedStatus());
+ }
+ return "Incorrect file name. Expected: " + expected + " Actual: " + actual;
+ }
}