Changes as [er review for BAEL-1960

This commit is contained in:
root 2018-07-25 23:24:03 +05:30
parent 380dce8e6e
commit c45c6d9ff1
2 changed files with 108 additions and 110 deletions

View File

@ -1,25 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion>
<modelVersion>4.0.0</modelVersion> <artifactId>log4j2</artifactId>
<artifactId>log4j2</artifactId>
<parent> <parent>
<groupId>com.baeldung</groupId> <groupId>com.baeldung</groupId>
<artifactId>parent-modules</artifactId> <artifactId>parent-modules</artifactId>
<version>1.0.0-SNAPSHOT</version> <version>1.0.0-SNAPSHOT</version>
<relativePath>../../</relativePath> <relativePath>../../</relativePath>
</parent> </parent>
<dependencies>
<!-- This is the needed core component. -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j-core.version}</version>
</dependency>
<dependencies>
<!-- This is the needed core component. -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j-core.version}</version>
</dependency>
<!-- This is the needed API component. --> <!-- This is the needed API component. -->
<dependency> <dependency>
<groupId>org.apache.logging.log4j</groupId> <groupId>org.apache.logging.log4j</groupId>
@ -27,100 +26,99 @@
<version>${log4j-core.version}</version> <version>${log4j-core.version}</version>
</dependency> </dependency>
<!-- This is used by JSONLayout. -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<!-- This is used by JSONLayout. --> <!-- This is used by XMLLayout. -->
<dependency> <dependency>
<groupId>com.fasterxml.jackson.core</groupId> <groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-databind</artifactId> <artifactId>jackson-dataformat-xml</artifactId>
<version>${jackson.version}</version> <version>${jackson.version}</version>
</dependency> </dependency>
<!-- This is used by XMLLayout. --> <!-- This is used by JDBC Appender. -->
<dependency> <dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId> <groupId>com.h2database</groupId>
<artifactId>jackson-dataformat-xml</artifactId> <artifactId>h2</artifactId>
<version>${jackson.version}</version> <version>${h2.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2</artifactId>
<version>${commons-dbcp2.version}</version>
</dependency>
<!-- This is used by JDBC Appender. --> <!-- This is used for testing only. -->
<dependency> <dependency>
<groupId>com.h2database</groupId> <groupId>org.apache.logging.log4j</groupId>
<artifactId>h2</artifactId> <artifactId>log4j-core</artifactId>
<version>${h2.version}</version> <version>${log4j-core.version}</version>
</dependency> <type>test-jar</type>
<dependency> <scope>test</scope>
<groupId>org.apache.commons</groupId> </dependency>
<artifactId>commons-dbcp2</artifactId> </dependencies>
<version>${commons-dbcp2.version}</version>
</dependency>
<!-- This is used for testing only. --> <build>
<dependency> <plugins>
<groupId>org.apache.logging.log4j</groupId> <plugin>
<artifactId>log4j-core</artifactId> <groupId>org.apache.maven.plugins</groupId>
<version>${log4j-core.version}</version> <artifactId>maven-compiler-plugin</artifactId>
<type>test-jar</type> <version>${maven-compiler-plugin.version}</version>
<scope>test</scope> <configuration>
</dependency> <proc>none</proc>
</dependencies> </configuration>
</plugin>
</plugins>
</build>
<build> <profiles>
<plugins> <profile>
<plugin> <id>integration</id>
<groupId>org.apache.maven.plugins</groupId> <build>
<artifactId>maven-compiler-plugin</artifactId> <plugins>
<version>${maven-compiler-plugin.version}</version> <plugin>
<configuration> <groupId>org.apache.maven.plugins</groupId>
<proc>none</proc> <artifactId>maven-surefire-plugin</artifactId>
</configuration> <executions>
</plugin> <execution>
</plugins> <phase>integration-test</phase>
</build> <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>
<profiles> <properties>
<profile> <jackson.version>2.9.5</jackson.version>
<id>integration</id> <h2.version>1.4.193</h2.version>
<build> <commons-dbcp2.version>2.1.1</commons-dbcp2.version>
<plugins> <log4j-core.version>2.11.0</log4j-core.version>
<plugin> <maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
<groupId>org.apache.maven.plugins</groupId> </properties>
<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> </project>
<jackson.version>2.9.5</jackson.version>
<h2.version>1.4.193</h2.version>
<commons-dbcp2.version>2.1.1</commons-dbcp2.version>
<log4j-core.version>2.11.0</log4j-core.version>
<maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
</properties>
</project>

View File

@ -18,7 +18,7 @@ import org.apache.logging.log4j.core.config.plugins.PluginAttribute;
import org.apache.logging.log4j.core.config.plugins.PluginElement; import org.apache.logging.log4j.core.config.plugins.PluginElement;
import org.apache.logging.log4j.core.config.plugins.PluginFactory; import org.apache.logging.log4j.core.config.plugins.PluginFactory;
@Plugin(name = "MapAppender", category = Core.CATEGORY_NAME, elementType = Appender.ELEMENT_TYPE, printObject = false) @Plugin(name = "MapAppender", category = Core.CATEGORY_NAME, elementType = Appender.ELEMENT_TYPE)
public class MapAppender extends AbstractAppender { public class MapAppender extends AbstractAppender {
private ConcurrentMap<String, LogEvent> eventMap = new ConcurrentHashMap<>(); private ConcurrentMap<String, LogEvent> eventMap = new ConcurrentHashMap<>();