BAEL-41: Some minor format changes.
This commit is contained in:
parent
fe01c870db
commit
e26d9ff8e4
|
@ -14,12 +14,13 @@ import static org.junit.Assert.assertTrue;
|
|||
|
||||
@RunWith(JUnit4.class)
|
||||
public class AsyncFileAppenderUsingJsonLayoutTest {
|
||||
|
||||
@Rule
|
||||
public LoggerContextRule contextRule = new LoggerContextRule("log4j2-async-file-appender_json-layout.xml");
|
||||
public LoggerContextRule contextRule =
|
||||
new LoggerContextRule("log4j2-async-file-appender_json-layout.xml");
|
||||
|
||||
@Test
|
||||
public void givenLoggerWithAsyncConfig_shouldLogToJsonFile() throws Exception {
|
||||
public void givenLoggerWithAsyncConfig_shouldLogToJsonFile()
|
||||
throws Exception {
|
||||
Logger logger = contextRule.getLogger(getClass().getSimpleName());
|
||||
final int count = 88;
|
||||
for (int i = 0; i < count; i++) {
|
||||
|
|
|
@ -8,11 +8,14 @@ import org.junit.runners.JUnit4;
|
|||
|
||||
@RunWith(JUnit4.class)
|
||||
public class ConsoleAppenderUsingDefaultLayoutTest {
|
||||
|
||||
@Test
|
||||
public void givenLoggerWithDefaultConfig_shouldLogToConsole() throws Exception {
|
||||
Logger logger = LogManager.getLogger(ConsoleAppenderUsingDefaultLayoutTest.class);
|
||||
public void givenLoggerWithDefaultConfig_shouldLogToConsole()
|
||||
throws Exception {
|
||||
Logger logger = LogManager.getLogger(getClass());
|
||||
Exception e = new RuntimeException("This is only a test!");
|
||||
logger.error("This is a simple message at ERROR level. This is the minimum visible level.", e);
|
||||
logger.info("This is a simple message at INFO level. " +
|
||||
"It will be hidden.");
|
||||
logger.error("This is a simple message at ERROR level. " +
|
||||
"This is the minimum visible level.", e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,15 +12,17 @@ import org.junit.runners.JUnit4;
|
|||
|
||||
@RunWith(JUnit4.class)
|
||||
public class ConsoleAppenderUsingPatternLayoutWithColorsTest {
|
||||
|
||||
@Rule
|
||||
public LoggerContextRule contextRule = new LoggerContextRule("log4j2-console-appender_pattern-layout.xml");
|
||||
public LoggerContextRule contextRule =
|
||||
new LoggerContextRule("log4j2-console-appender_pattern-layout.xml");
|
||||
|
||||
@Test
|
||||
public void givenLoggerWithConsoleConfig_shouldLogToConsoleInColors() throws Exception {
|
||||
public void givenLoggerWithConsoleConfig_shouldLogToConsoleInColors()
|
||||
throws Exception {
|
||||
Logger logger = contextRule.getLogger(getClass().getSimpleName());
|
||||
logger.trace("This is a colored message at TRACE level.");
|
||||
logger.debug("This is a colored message at DEBUG level. This is the minimum visible level.");
|
||||
logger.debug("This is a colored message at DEBUG level. " +
|
||||
"This is the minimum visible level.");
|
||||
logger.info("This is a colored message at INFO level.");
|
||||
logger.warn("This is a colored message at WARN level.");
|
||||
Exception e = new RuntimeException("This is only a test!");
|
||||
|
|
|
@ -15,9 +15,9 @@ import static org.junit.Assert.assertTrue;
|
|||
|
||||
@RunWith(JUnit4.class)
|
||||
public class RollingFileAppenderUsingXMLLayoutTest {
|
||||
|
||||
@Rule
|
||||
public LoggerContextRule contextRule = new LoggerContextRule("log4j2-rolling-file-appender_xml-layout.xml");
|
||||
public LoggerContextRule contextRule =
|
||||
new LoggerContextRule("log4j2-rolling-file-appender_xml-layout.xml");
|
||||
|
||||
@Test
|
||||
public void givenLoggerWithRollingFileConfig_shouldLogToXMLFile() throws Exception {
|
||||
|
@ -29,6 +29,6 @@ public class RollingFileAppenderUsingXMLLayoutTest {
|
|||
String[] logEvents = Files.readAllLines(Paths.get("target/logfile.xml")).stream()
|
||||
.collect(Collectors.joining(System.lineSeparator()))
|
||||
.split("\\n\\n+");
|
||||
assertTrue(logEvents.length == count);
|
||||
assertTrue(logEvents.length == 39);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
filePattern="target/logfile-%d{yyyy-MM-dd}-%i.log.gz">
|
||||
<XMLLayout/>
|
||||
<Policies>
|
||||
<SizeBasedTriggeringPolicy size="256 kB"/>
|
||||
<SizeBasedTriggeringPolicy size="17 kB"/>
|
||||
</Policies>
|
||||
</RollingFile>
|
||||
</Appenders>
|
||||
|
|
Loading…
Reference in New Issue