Skip to content

Commit c45c6d9

Browse files
author
root
committed
Changes as [er review for BAEL-1960
1 parent 380dce8 commit c45c6d9

2 files changed

Lines changed: 108 additions & 110 deletions

File tree

‎logging-modules/log4j2/pom.xml‎

Lines changed: 107 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,126 +1,124 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5-
<modelVersion>4.0.0</modelVersion>
6-
<artifactId>log4j2</artifactId>
2+
<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>
5+
<artifactId>log4j2</artifactId>
76

8-
<parent>
9-
<groupId>com.baeldung</groupId>
10-
<artifactId>parent-modules</artifactId>
11-
<version>1.0.0-SNAPSHOT</version>
12-
<relativePath>../../</relativePath>
13-
</parent>
14-
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>
7+
<parent>
8+
<groupId>com.baeldung</groupId>
9+
<artifactId>parent-modules</artifactId>
10+
<version>1.0.0-SNAPSHOT</version>
11+
<relativePath>../../</relativePath>
12+
</parent>
2213

14+
<dependencies>
15+
<!-- This is the needed core component. -->
16+
<dependency>
17+
<groupId>org.apache.logging.log4j</groupId>
18+
<artifactId>log4j-core</artifactId>
19+
<version>${log4j-core.version}</version>
20+
</dependency>
21+
2322
<!-- This is the needed API component. -->
2423
<dependency>
2524
<groupId>org.apache.logging.log4j</groupId>
2625
<artifactId>log4j-api</artifactId>
2726
<version>${log4j-core.version}</version>
2827
</dependency>
2928

29+
<!-- This is used by JSONLayout. -->
30+
<dependency>
31+
<groupId>com.fasterxml.jackson.core</groupId>
32+
<artifactId>jackson-databind</artifactId>
33+
<version>${jackson.version}</version>
34+
</dependency>
3035

31-
<!-- This is used by JSONLayout. -->
32-
<dependency>
33-
<groupId>com.fasterxml.jackson.core</groupId>
34-
<artifactId>jackson-databind</artifactId>
35-
<version>${jackson.version}</version>
36-
</dependency>
37-
38-
<!-- This is used by XMLLayout. -->
39-
<dependency>
40-
<groupId>com.fasterxml.jackson.dataformat</groupId>
41-
<artifactId>jackson-dataformat-xml</artifactId>
42-
<version>${jackson.version}</version>
43-
</dependency>
36+
<!-- This is used by XMLLayout. -->
37+
<dependency>
38+
<groupId>com.fasterxml.jackson.dataformat</groupId>
39+
<artifactId>jackson-dataformat-xml</artifactId>
40+
<version>${jackson.version}</version>
41+
</dependency>
4442

45-
<!-- This is used by JDBC Appender. -->
46-
<dependency>
47-
<groupId>com.h2database</groupId>
48-
<artifactId>h2</artifactId>
49-
<version>${h2.version}</version>
50-
</dependency>
51-
<dependency>
52-
<groupId>org.apache.commons</groupId>
53-
<artifactId>commons-dbcp2</artifactId>
54-
<version>${commons-dbcp2.version}</version>
55-
</dependency>
43+
<!-- This is used by JDBC Appender. -->
44+
<dependency>
45+
<groupId>com.h2database</groupId>
46+
<artifactId>h2</artifactId>
47+
<version>${h2.version}</version>
48+
</dependency>
49+
<dependency>
50+
<groupId>org.apache.commons</groupId>
51+
<artifactId>commons-dbcp2</artifactId>
52+
<version>${commons-dbcp2.version}</version>
53+
</dependency>
5654

57-
<!-- This is used for testing only. -->
58-
<dependency>
59-
<groupId>org.apache.logging.log4j</groupId>
60-
<artifactId>log4j-core</artifactId>
61-
<version>${log4j-core.version}</version>
62-
<type>test-jar</type>
63-
<scope>test</scope>
64-
</dependency>
65-
</dependencies>
55+
<!-- This is used for testing only. -->
56+
<dependency>
57+
<groupId>org.apache.logging.log4j</groupId>
58+
<artifactId>log4j-core</artifactId>
59+
<version>${log4j-core.version}</version>
60+
<type>test-jar</type>
61+
<scope>test</scope>
62+
</dependency>
63+
</dependencies>
6664

67-
<build>
68-
<plugins>
69-
<plugin>
70-
<groupId>org.apache.maven.plugins</groupId>
71-
<artifactId>maven-compiler-plugin</artifactId>
72-
<version>${maven-compiler-plugin.version}</version>
73-
<configuration>
74-
<proc>none</proc>
75-
</configuration>
76-
</plugin>
77-
</plugins>
78-
</build>
65+
<build>
66+
<plugins>
67+
<plugin>
68+
<groupId>org.apache.maven.plugins</groupId>
69+
<artifactId>maven-compiler-plugin</artifactId>
70+
<version>${maven-compiler-plugin.version}</version>
71+
<configuration>
72+
<proc>none</proc>
73+
</configuration>
74+
</plugin>
75+
</plugins>
76+
</build>
7977

80-
<profiles>
81-
<profile>
82-
<id>integration</id>
83-
<build>
84-
<plugins>
85-
<plugin>
86-
<groupId>org.apache.maven.plugins</groupId>
87-
<artifactId>maven-surefire-plugin</artifactId>
88-
<executions>
89-
<execution>
90-
<phase>integration-test</phase>
91-
<goals>
92-
<goal>test</goal>
93-
</goals>
94-
<configuration>
95-
<excludes>
96-
<exclude>**/*ManualTest.java</exclude>
97-
<exclude>**/*LiveTest.java</exclude>
98-
</excludes>
99-
<includes>
100-
<include>**/*IntegrationTest.java</include>
101-
<include>**/*IntTest.java</include>
102-
</includes>
103-
</configuration>
104-
</execution>
105-
</executions>
106-
<configuration>
107-
<systemPropertyVariables>
108-
<test.mime>json</test.mime>
109-
<logging.folder.path>${java.io.tmpdir}/${maven.build.timestamp}/logfile.json</logging.folder.path>
110-
</systemPropertyVariables>
111-
</configuration>
112-
</plugin>
113-
</plugins>
114-
</build>
115-
</profile>
116-
</profiles>
78+
<profiles>
79+
<profile>
80+
<id>integration</id>
81+
<build>
82+
<plugins>
83+
<plugin>
84+
<groupId>org.apache.maven.plugins</groupId>
85+
<artifactId>maven-surefire-plugin</artifactId>
86+
<executions>
87+
<execution>
88+
<phase>integration-test</phase>
89+
<goals>
90+
<goal>test</goal>
91+
</goals>
92+
<configuration>
93+
<excludes>
94+
<exclude>**/*ManualTest.java</exclude>
95+
<exclude>**/*LiveTest.java</exclude>
96+
</excludes>
97+
<includes>
98+
<include>**/*IntegrationTest.java</include>
99+
<include>**/*IntTest.java</include>
100+
</includes>
101+
</configuration>
102+
</execution>
103+
</executions>
104+
<configuration>
105+
<systemPropertyVariables>
106+
<test.mime>json</test.mime>
107+
<logging.folder.path>${java.io.tmpdir}/${maven.build.timestamp}/logfile.json</logging.folder.path>
108+
</systemPropertyVariables>
109+
</configuration>
110+
</plugin>
111+
</plugins>
112+
</build>
113+
</profile>
114+
</profiles>
117115

118-
<properties>
119-
<jackson.version>2.9.5</jackson.version>
120-
<h2.version>1.4.193</h2.version>
121-
<commons-dbcp2.version>2.1.1</commons-dbcp2.version>
122-
<log4j-core.version>2.11.0</log4j-core.version>
123-
<maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
124-
</properties>
116+
<properties>
117+
<jackson.version>2.9.5</jackson.version>
118+
<h2.version>1.4.193</h2.version>
119+
<commons-dbcp2.version>2.1.1</commons-dbcp2.version>
120+
<log4j-core.version>2.11.0</log4j-core.version>
121+
<maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
122+
</properties>
125123

126-
</project>
124+
</project>

‎logging-modules/log4j2/src/main/java/com/baeldung/logging/log4j2/appender/MapAppender.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import org.apache.logging.log4j.core.config.plugins.PluginElement;
1919
import org.apache.logging.log4j.core.config.plugins.PluginFactory;
2020

21-
@Plugin(name = "MapAppender", category = Core.CATEGORY_NAME, elementType = Appender.ELEMENT_TYPE, printObject = false)
21+
@Plugin(name = "MapAppender", category = Core.CATEGORY_NAME, elementType = Appender.ELEMENT_TYPE)
2222
public class MapAppender extends AbstractAppender {
2323

2424
private ConcurrentMap<String, LogEvent> eventMap = new ConcurrentHashMap<>();

0 commit comments

Comments
 (0)