[JAVA-18156] (#13787)
* [JAVA-18156] * [JAVA-18156] Revert changes + use correct profile
This commit is contained in:
parent
b280691134
commit
4272773056
@ -68,46 +68,19 @@
|
|||||||
<proc>none</proc>
|
<proc>none</proc>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<systemPropertyVariables>
|
||||||
|
<test.mime>json</test.mime>
|
||||||
|
<logging.folder.path>${java.io.tmpdir}/${maven.build.timestamp}/logfile.json</logging.folder.path>
|
||||||
|
</systemPropertyVariables>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<profiles>
|
|
||||||
<profile>
|
|
||||||
<id>integration-lite-first</id>
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<phase>integration-test</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>test</goal>
|
|
||||||
</goals>
|
|
||||||
<configuration>
|
|
||||||
<excludes>
|
|
||||||
<exclude>**/*ManualTest.java</exclude>
|
|
||||||
<exclude>**/*LiveTest.java</exclude>
|
|
||||||
</excludes>
|
|
||||||
<includes>
|
|
||||||
<include>**/*IntegrationTest.java</include>
|
|
||||||
<include>**/*IntTest.java</include>
|
|
||||||
</includes>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
<configuration>
|
|
||||||
<systemPropertyVariables>
|
|
||||||
<test.mime>json</test.mime>
|
|
||||||
<logging.folder.path>${java.io.tmpdir}/${maven.build.timestamp}/logfile.json</logging.folder.path>
|
|
||||||
</systemPropertyVariables>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</profile>
|
|
||||||
</profiles>
|
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<commons-dbcp2.version>2.9.0</commons-dbcp2.version>
|
<commons-dbcp2.version>2.9.0</commons-dbcp2.version>
|
||||||
|
@ -21,7 +21,7 @@ import com.baeldung.logging.log4j2.tests.jdbc.ConnectionFactory;
|
|||||||
|
|
||||||
@RunWith(JUnit4.class)
|
@RunWith(JUnit4.class)
|
||||||
public class CustomLoggingIntegrationTest {
|
public class CustomLoggingIntegrationTest {
|
||||||
|
|
||||||
private static String logFilePath = System.getProperty("logging.folder.path");
|
private static String logFilePath = System.getProperty("logging.folder.path");
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
@ -34,7 +34,7 @@ public class CustomLoggingIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenLoggerWithDefaultConfig_whenLogToConsole_thanOK() throws Exception {
|
public void givenLoggerWithDefaultConfig_whenLogToConsole_thenOK() throws Exception {
|
||||||
Logger logger = LogManager.getLogger(getClass());
|
Logger logger = LogManager.getLogger(getClass());
|
||||||
Exception e = new RuntimeException("This is only a test!");
|
Exception e = new RuntimeException("This is only a test!");
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ public class CustomLoggingIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenLoggerWithConsoleConfig_whenLogToConsoleInColors_thanOK() throws Exception {
|
public void givenLoggerWithConsoleConfig_whenLogToConsoleInColors_thenOK() throws Exception {
|
||||||
Logger logger = LogManager.getLogger("CONSOLE_PATTERN_APPENDER_MARKER");
|
Logger logger = LogManager.getLogger("CONSOLE_PATTERN_APPENDER_MARKER");
|
||||||
Exception e = new RuntimeException("This is only a test!");
|
Exception e = new RuntimeException("This is only a test!");
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ public class CustomLoggingIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenLoggerWithConsoleConfig_whenFilterByMarker_thanOK() throws Exception {
|
public void givenLoggerWithConsoleConfig_whenFilterByMarker_thenOK() throws Exception {
|
||||||
Logger logger = LogManager.getLogger("CONSOLE_PATTERN_APPENDER_MARKER");
|
Logger logger = LogManager.getLogger("CONSOLE_PATTERN_APPENDER_MARKER");
|
||||||
Marker appError = MarkerManager.getMarker("APP_ERROR");
|
Marker appError = MarkerManager.getMarker("APP_ERROR");
|
||||||
Marker connectionTrace = MarkerManager.getMarker("CONN_TRACE");
|
Marker connectionTrace = MarkerManager.getMarker("CONN_TRACE");
|
||||||
@ -66,7 +66,7 @@ public class CustomLoggingIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenLoggerWithConsoleConfig_whenFilterByThreadContext_thanOK() throws Exception {
|
public void givenLoggerWithConsoleConfig_whenFilterByThreadContext_thenOK() throws Exception {
|
||||||
Logger logger = LogManager.getLogger("CONSOLE_PATTERN_APPENDER_THREAD_CONTEXT");
|
Logger logger = LogManager.getLogger("CONSOLE_PATTERN_APPENDER_THREAD_CONTEXT");
|
||||||
ThreadContext.put("userId", "1000");
|
ThreadContext.put("userId", "1000");
|
||||||
logger.info("This is a log-visible user login. Maybe from an admin account?");
|
logger.info("This is a log-visible user login. Maybe from an admin account?");
|
||||||
@ -75,7 +75,7 @@ public class CustomLoggingIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenLoggerWithAsyncConfig_whenLogToJsonFile_thanOK() throws Exception {
|
public void givenLoggerWithAsyncConfig_whenLogToJsonFile_thenOK() throws Exception {
|
||||||
Logger logger = LogManager.getLogger("ASYNC_JSON_FILE_APPENDER");
|
Logger logger = LogManager.getLogger("ASYNC_JSON_FILE_APPENDER");
|
||||||
|
|
||||||
final int count = 88;
|
final int count = 88;
|
||||||
@ -90,7 +90,7 @@ public class CustomLoggingIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenLoggerWithFailoverConfig_whenLog_thanOK() throws Exception {
|
public void givenLoggerWithFailoverConfig_whenLog_thenOK() throws Exception {
|
||||||
Logger logger = LogManager.getLogger("FAIL_OVER_SYSLOG_APPENDER");
|
Logger logger = LogManager.getLogger("FAIL_OVER_SYSLOG_APPENDER");
|
||||||
Exception e = new RuntimeException("This is only a test!");
|
Exception e = new RuntimeException("This is only a test!");
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ public class CustomLoggingIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenLoggerWithJdbcConfig_whenLogToDataSource_thanOK() throws Exception {
|
public void givenLoggerWithJdbcConfig_whenLogToDataSource_thenOK() throws Exception {
|
||||||
Logger logger = LogManager.getLogger("JDBC_APPENDER");
|
Logger logger = LogManager.getLogger("JDBC_APPENDER");
|
||||||
|
|
||||||
final int count = 88;
|
final int count = 88;
|
||||||
@ -122,7 +122,7 @@ public class CustomLoggingIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenLoggerWithRollingFileConfig_whenLogToXMLFile_thanOK() throws Exception {
|
public void givenLoggerWithRollingFileConfig_whenLogToXMLFile_thenOK() throws Exception {
|
||||||
Logger logger = LogManager.getLogger("XML_ROLLING_FILE_APPENDER");
|
Logger logger = LogManager.getLogger("XML_ROLLING_FILE_APPENDER");
|
||||||
|
|
||||||
final int count = 88;
|
final int count = 88;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Configuration xmlns:xi="http://www.w3.org/2001/XInclude"
|
<Configuration xmlns:xi="http://www.w3.org/2001/XInclude"
|
||||||
packages="com.baeldung" status="WARN">
|
packages="com.baeldung" status="WARN">
|
||||||
<Appenders>
|
<Appenders>
|
||||||
<xi:include
|
<xi:include
|
||||||
@ -20,7 +20,7 @@
|
|||||||
<KeyValuePair key="myCustomField" value="myCustomValue" />
|
<KeyValuePair key="myCustomField" value="myCustomValue" />
|
||||||
</JsonLayout>
|
</JsonLayout>
|
||||||
</Console>
|
</Console>
|
||||||
<File name="JSONLogfileAppender" fileName="${sys:logging.folder.path}">
|
<File name="JSONLogfileAppender" fileName="${sys:logging.folder.path}" >
|
||||||
<JSONLayout compact="true" eventEol="true" />
|
<JSONLayout compact="true" eventEol="true" />
|
||||||
<BurstFilter level="INFO" rate="2" maxBurst="10" />
|
<BurstFilter level="INFO" rate="2" maxBurst="10" />
|
||||||
</File>
|
</File>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user