diff --git a/log4j/pom.xml b/log4j/pom.xml
index 5c73dc848d..a70dab9d22 100644
--- a/log4j/pom.xml
+++ b/log4j/pom.xml
@@ -10,7 +10,6 @@
-
log4j
log4j
@@ -19,26 +18,23 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+ org.apache.logging.log4j
+ log4j-api
+ 2.6
+
+
+ org.apache.logging.log4j
+ log4j-core
+ 2.6
+
-
-
-
-
-
-
+
+ ch.qos.logback
+ logback-classic
+ 1.1.7
+
diff --git a/log4j/src/main/java/com/baeldung/log4j2/Log4j2Example.java b/log4j/src/main/java/com/baeldung/log4j2/Log4j2Example.java
new file mode 100644
index 0000000000..60acc3a774
--- /dev/null
+++ b/log4j/src/main/java/com/baeldung/log4j2/Log4j2Example.java
@@ -0,0 +1,16 @@
+package com.baeldung.log4j2;
+
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+
+public class Log4j2Example {
+
+ private static final Logger logger = LogManager.getLogger(Log4j2Example.class);
+
+ public static void main(String[] args) {
+ logger.debug("Debug log message");
+ logger.info("Info log message");
+ logger.error("Error log message");
+ }
+
+}
diff --git a/log4j/src/main/java/com/baeldung/logback/LogbackExample.java b/log4j/src/main/java/com/baeldung/logback/LogbackExample.java
new file mode 100644
index 0000000000..536aa78ec9
--- /dev/null
+++ b/log4j/src/main/java/com/baeldung/logback/LogbackExample.java
@@ -0,0 +1,16 @@
+package com.baeldung.logback;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class LogbackExample {
+
+ private static final Logger logger = LoggerFactory.getLogger(LogbackExample.class);
+
+ public static void main(String[] args) {
+ logger.debug("Debug log message");
+ logger.info("Info log message");
+ logger.error("Error log message");
+ }
+
+}
diff --git a/log4j/src/main/resources/log4j.xml b/log4j/src/main/resources/log4j.xml
index 1de6c62caf..6f64c63572 100644
--- a/log4j/src/main/resources/log4j.xml
+++ b/log4j/src/main/resources/log4j.xml
@@ -13,7 +13,7 @@
-
+
diff --git a/log4j/src/main/resources/log4j2.xml b/log4j/src/main/resources/log4j2.xml
index 0a854b25b7..56c6706e91 100644
--- a/log4j/src/main/resources/log4j2.xml
+++ b/log4j/src/main/resources/log4j2.xml
@@ -4,19 +4,19 @@
# Console appender
# Pattern of log message for console appender
-
+
# File appender
# Pattern of log message for file appender
-
+
# Override log level for specified package
-
+
diff --git a/log4j/src/main/resources/logback.xml b/log4j/src/main/resources/logback.xml
index c70bceab16..c1fd0aee59 100644
--- a/log4j/src/main/resources/logback.xml
+++ b/log4j/src/main/resources/logback.xml
@@ -3,7 +3,7 @@
# Pattern of log message for console appender
- %d{yyyy-MM-dd HH:mm:ss} %-5p %m%n
+ %d{yyyy-MM-dd HH:mm:ss} %p %m%n
@@ -14,12 +14,12 @@
false
# Pattern of log message for file appender
- %d{yyyy-MM-dd HH:mm:ss} %-5p %m%n
+ %d{yyyy-MM-dd HH:mm:ss} %p %m%n
# Override log level for specified package
-
+