Updated log4j configuration using Log4j 2 and JUL.
Change-Id: I90b3c44ca73701b711a8948442c5aeef21d6feb0
diff --git a/pom.xml b/pom.xml
index 5ca6b15..bfaa8a4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,6 +24,10 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
+ <configuration>
+ <argLine>-Dmockserver.logLevel=OFF
+ -Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager</argLine>
+ </configuration>
</plugin>
</plugins>
</build>
@@ -31,7 +35,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jersey.version>1.19.4</jersey.version>
- <slf4j.version>1.7.30</slf4j.version>
+ <log4j.version>2.14.1</log4j.version>
</properties>
<dependencies>
@@ -63,16 +67,7 @@
<artifactId>jackson-databind</artifactId>
<version>2.12.2</version>
</dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>${slf4j.version}</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-jdk14</artifactId>
- <version>${slf4j.version}</version>
- </dependency>
+
<dependency>
<groupId>org.apache.directory.studio</groupId>
<artifactId>org.apache.commons.lang</artifactId>
@@ -91,6 +86,28 @@
<scope>test</scope>
</dependency>
+ <!-- logging -->
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-api</artifactId>
+ <version>${log4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-core</artifactId>
+ <version>${log4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-slf4j-impl</artifactId>
+ <version>${log4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-jul</artifactId>
+ <version>${log4j.version}</version>
+ </dependency>
+
<!-- Mockserver -->
<dependency>
<groupId>org.mock-server</groupId>
diff --git a/src/main/resources/log4j.properties b/src/main/resources/log4j.properties
deleted file mode 100644
index 5564f24..0000000
--- a/src/main/resources/log4j.properties
+++ /dev/null
@@ -1,7 +0,0 @@
-log4j.rootLogger = ERROR, stdout
-#log4j.rootLogger = DEBUG, stdout
-
-log4j.appender.stdout = org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.Target= System.out
-log4j.appender.stdout.layout = org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern = %5p (%F:%L) -> %m%n
\ No newline at end of file
diff --git a/src/main/resources/log4j2.properties b/src/main/resources/log4j2.properties
new file mode 100644
index 0000000..7cf3348
--- /dev/null
+++ b/src/main/resources/log4j2.properties
@@ -0,0 +1,9 @@
+appenders = console
+appender.console.type = Console
+appender.console.name = STDOUT
+appender.console.layout.type = PatternLayout
+appender.console.layout.pattern = %d{yyyy-MM-dd, HH:mm:ss} %C{6} - %M%n %-5p: %m%n
+
+rootLogger.level = warn
+rootLogger.appenderRefs = console
+rootLogger.additivity=false
\ No newline at end of file