Skip to content

Commit 99c8ee5

Browse files
committed
BAEL-41 Intro to Log4J2 code simplification and refactoring
1 parent 6d9c24a commit 99c8ee5

16 files changed

Lines changed: 273 additions & 414 deletions

‎log4j2/pom.xml‎

Lines changed: 89 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,104 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4-
<modelVersion>4.0.0</modelVersion>
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
55

6-
<artifactId>log4j2</artifactId>
6+
<artifactId>log4j2</artifactId>
77

8-
<parent>
9-
<groupId>com.baeldung</groupId>
10-
<artifactId>parent-modules</artifactId>
11-
<version>1.0.0-SNAPSHOT</version>
12-
<relativePath>..</relativePath>
13-
</parent>
8+
<parent>
9+
<groupId>com.baeldung</groupId>
10+
<artifactId>parent-modules</artifactId>
11+
<version>1.0.0-SNAPSHOT</version>
12+
<relativePath>..</relativePath>
13+
</parent>
1414

15-
<dependencies>
16-
<!-- This is the needed core component. -->
17-
<dependency>
18-
<groupId>org.apache.logging.log4j</groupId>
19-
<artifactId>log4j-core</artifactId>
20-
<version>${log4j-core.version}</version>
21-
</dependency>
15+
<dependencies>
16+
<!-- This is the needed core component. -->
17+
<dependency>
18+
<groupId>org.apache.logging.log4j</groupId>
19+
<artifactId>log4j-core</artifactId>
20+
<version>${log4j-core.version}</version>
21+
</dependency>
2222

23-
<!-- This is used by JSONLayout. -->
24-
<dependency>
25-
<groupId>com.fasterxml.jackson.core</groupId>
26-
<artifactId>jackson-databind</artifactId>
27-
<version>${jackson.version}</version>
28-
</dependency>
23+
<!-- This is used by JSONLayout. -->
24+
<dependency>
25+
<groupId>com.fasterxml.jackson.core</groupId>
26+
<artifactId>jackson-databind</artifactId>
27+
<version>${jackson.version}</version>
28+
</dependency>
2929

30-
<!-- This is used by XMLLayout. -->
31-
<dependency>
32-
<groupId>com.fasterxml.jackson.dataformat</groupId>
33-
<artifactId>jackson-dataformat-xml</artifactId>
34-
<version>${jackson.version}</version>
35-
</dependency>
30+
<!-- This is used by XMLLayout. -->
31+
<dependency>
32+
<groupId>com.fasterxml.jackson.dataformat</groupId>
33+
<artifactId>jackson-dataformat-xml</artifactId>
34+
<version>${jackson.version}</version>
35+
</dependency>
3636

37-
<!-- This is used by JDBC Appender. -->
38-
<dependency>
39-
<groupId>com.h2database</groupId>
40-
<artifactId>h2</artifactId>
41-
<version>${h2.version}</version>
42-
</dependency>
43-
<dependency>
44-
<groupId>org.apache.commons</groupId>
45-
<artifactId>commons-dbcp2</artifactId>
46-
<version>${commons-dbcp2.version}</version>
47-
</dependency>
37+
<!-- This is used by JDBC Appender. -->
38+
<dependency>
39+
<groupId>com.h2database</groupId>
40+
<artifactId>h2</artifactId>
41+
<version>${h2.version}</version>
42+
</dependency>
43+
<dependency>
44+
<groupId>org.apache.commons</groupId>
45+
<artifactId>commons-dbcp2</artifactId>
46+
<version>${commons-dbcp2.version}</version>
47+
</dependency>
4848

49-
<!-- This is used for testing only. -->
50-
<dependency>
51-
<groupId>org.apache.logging.log4j</groupId>
52-
<artifactId>log4j-core</artifactId>
53-
<version>${log4j-core.version}</version>
54-
<type>test-jar</type>
55-
<scope>test</scope>
56-
</dependency>
57-
<dependency>
58-
<groupId>junit</groupId>
59-
<artifactId>junit</artifactId>
60-
<version>${junit.version}</version>
61-
<scope>test</scope>
62-
</dependency>
63-
</dependencies>
49+
<!-- This is used for testing only. -->
50+
<dependency>
51+
<groupId>org.apache.logging.log4j</groupId>
52+
<artifactId>log4j-core</artifactId>
53+
<version>${log4j-core.version}</version>
54+
<type>test-jar</type>
55+
<scope>test</scope>
56+
</dependency>
57+
<dependency>
58+
<groupId>junit</groupId>
59+
<artifactId>junit</artifactId>
60+
<version>${junit.version}</version>
61+
<scope>test</scope>
62+
</dependency>
63+
</dependencies>
6464

65-
<build>
66-
<plugins>
65+
<build>
66+
<plugins>
6767

68-
<plugin>
69-
<groupId>org.apache.maven.plugins</groupId>
70-
<artifactId>maven-compiler-plugin</artifactId>
71-
<version>${maven-compiler-plugin.version}</version>
72-
<configuration>
73-
<source>1.8</source>
74-
<target>1.8</target>
75-
</configuration>
76-
</plugin>
77-
<plugin>
78-
<groupId>org.apache.maven.plugins</groupId>
79-
<artifactId>maven-surefire-plugin</artifactId>
80-
<version>${maven-surefire-plugin.version}</version>
81-
<configuration>
82-
<excludes>
83-
<exclude>**/*IntegrationTest.java</exclude>
84-
<exclude>**/*LongRunningUnitTest.java</exclude>
85-
<exclude>**/*ManualTest.java</exclude>
86-
</excludes>
87-
<testFailureIgnore>true</testFailureIgnore>
88-
</configuration>
89-
</plugin>
68+
<plugin>
69+
<groupId>org.apache.maven.plugins</groupId>
70+
<artifactId>maven-compiler-plugin</artifactId>
71+
<version>${maven-compiler-plugin.version}</version>
72+
<configuration>
73+
<source>1.8</source>
74+
<target>1.8</target>
75+
</configuration>
76+
</plugin>
77+
<plugin>
78+
<groupId>org.apache.maven.plugins</groupId>
79+
<artifactId>maven-surefire-plugin</artifactId>
80+
<version>${maven-surefire-plugin.version}</version>
81+
<configuration>
82+
<excludes>
83+
<exclude>**/*IntegrationTest.java</exclude>
84+
<exclude>**/*LongRunningUnitTest.java</exclude>
85+
<exclude>**/*ManualTest.java</exclude>
86+
</excludes>
87+
<testFailureIgnore>true</testFailureIgnore>
88+
</configuration>
89+
</plugin>
9090

91-
</plugins>
92-
</build>
91+
</plugins>
92+
</build>
9393

94-
<properties>
95-
<jackson.version>2.8.5</jackson.version>
96-
<h2.version>1.4.193</h2.version>
97-
<commons-dbcp2.version>2.1.1</commons-dbcp2.version>
98-
<log4j-core.version>2.7</log4j-core.version>
99-
<junit.version>4.12</junit.version>
100-
101-
<maven-compiler-plugin.version>3.6.0</maven-compiler-plugin.version>
102-
<maven-surefire-plugin.version>2.19.1</maven-surefire-plugin.version>
103-
</properties>
94+
<properties>
95+
<jackson.version>2.8.5</jackson.version>
96+
<h2.version>1.4.193</h2.version>
97+
<commons-dbcp2.version>2.1.1</commons-dbcp2.version>
98+
<log4j-core.version>2.7</log4j-core.version>
99+
<junit.version>4.12</junit.version>
100+
<maven-compiler-plugin.version>3.6.0</maven-compiler-plugin.version>
101+
<maven-surefire-plugin.version>2.19.1</maven-surefire-plugin.version>
102+
</properties>
104103

105104
</project>

‎log4j2/src/test/java/com/baeldung/logging/log4j2/tests/AsyncFileAppenderUsingJsonLayoutTest.java‎

Lines changed: 0 additions & 32 deletions
This file was deleted.

‎log4j2/src/test/java/com/baeldung/logging/log4j2/tests/ConsoleAppenderUsingDefaultLayoutTest.java‎

Lines changed: 0 additions & 21 deletions
This file was deleted.

‎log4j2/src/test/java/com/baeldung/logging/log4j2/tests/ConsoleAppenderUsingPatternLayoutWithColorsTest.java‎

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)