Add a listener to enable logging
@@ -19,13 +19,17 @@ package org.apache.logging.log4j.core.appender.rolling;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
+import java.io.IOException;
import java.util.List;
+import org.apache.logging.log4j.Level;
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.StatusListener;
import org.apache.logging.log4j.status.StatusLogger;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.RuleChain;
@@ -55,6 +59,11 @@ public class RollingAppenderDirectWrite1906Test {
private Logger logger;
+ @BeforeClass
+ public static void setupClass() throws Exception {
+ StatusLogger.getLogger().registerListener(new NoopStatusListener());
+ }
+
@Before
public void setUp() throws Exception {
this.logger = loggerContextRule.getLogger(RollingAppenderDirectWrite1906Test.class.getName());
@@ -102,4 +111,21 @@ public class RollingAppenderDirectWrite1906Test {
sb.append("Incorrect file name. Expected: ").append(expected).append(" Actual: ").append(actual);
return sb.toString();
}
+
+ private static class NoopStatusListener implements StatusListener {
+ @Override
+ public void log(StatusData data) {
+
+ }
+
+ @Override
+ public Level getStatusLevel() {
+ return Level.TRACE;
+ }
+
+ @Override
+ public void close() throws IOException {
+
+ }
+ }
}
