diff --git a/NOTICE b/NOTICE
index 3272f57829..16dd1ec732 100644
--- a/NOTICE
+++ b/NOTICE
@@ -24,6 +24,12 @@ The following libraries are included in packaged versions of this project:
* NOTICE: licenses/NOTICE.log4j.txt
* HOMEPAGE: http://logging.apache.org/log4j/1.2/
+* Apache Log4j
+ * COPYRIGHT: Copyright 1999-2024 Apache Software Foundation
+ * LICENSE: licenses/LICENSE.apache2.txt
+ * NOTICE: licenses/NOTICE.log4j2.txt
+ * HOMEPAGE: https://logging.apache.org/log4j/2.x/
+
* Apache ZooKeeper
* COPYRIGHT: Copyright 2009-2014 The Apache Software Foundation
* LICENSE: licenses/LICENSE.apache2.txt
diff --git a/config/log4j.properties b/config/log4j.properties
deleted file mode 100644
index ff3a93fb2a..0000000000
--- a/config/log4j.properties
+++ /dev/null
@@ -1,12 +0,0 @@
-log4j.rootLogger=INFO, stdout, file
-
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=[%d] %p %m (%c:%L)%n
-
-log4j.appender.file=org.apache.log4j.RollingFileAppender
-log4j.appender.file.maxBackupIndex=10
-log4j.appender.file.maxFileSize=100MB
-log4j.appender.file.File=${kafka-rest.log.dir}/kafka-rest.log
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=[%d] %p %m (%c)%n
diff --git a/config/log4j2.yaml b/config/log4j2.yaml
new file mode 100644
index 0000000000..82c2e341f4
--- /dev/null
+++ b/config/log4j2.yaml
@@ -0,0 +1,32 @@
+Configuration:
+ name: "Log4j2"
+ Properties:
+ Property:
+ # Fallback if the system property is not set
+ - name: "kafka-rest.logs.dir"
+ value: "."
+ Appenders:
+ RollingFile:
+ name: "file"
+ fileName: "${sys:kafka-rest.log.dir}/kafka-rest.log"
+ filePattern: "/kafka-rest.log.%i"
+ PatternLayout:
+ pattern: "[%d] %v1Level %m (%c)%n"
+ Policies:
+ SizeBasedTriggeringPolicy:
+ size: "100MB"
+ DefaultRolloverStrategy:
+ max: "10"
+ # Using the min strategy, the newest log file will have index 1 and the oldest one will have index max.
+ fileIndex: "min"
+ Console:
+ name: "STDOUT"
+ target: "SYSTEM_OUT"
+ PatternLayout:
+ pattern: "[%d] %v1Level %m (%c:%L)%n"
+ Loggers:
+ Root:
+ level: "INFO"
+ AppenderRef:
+ - ref: "file"
+ - ref: "STDOUT"
diff --git a/kafka-rest/pom.xml b/kafka-rest/pom.xml
index baa53211e4..8456c853bb 100644
--- a/kafka-rest/pom.xml
+++ b/kafka-rest/pom.xml
@@ -63,8 +63,13 @@
${io.confluent.schema-registry.version}
- org.slf4j
- slf4j-reload4j
+ org.apache.logging.log4j
+ log4j-slf4j-impl
+
+
+ com.fasterxml.jackson.dataformat
+ jackson-dataformat-yaml
+ runtime
io.confluent
@@ -147,6 +152,12 @@
kafka-schema-registry
${io.confluent.schema-registry.version}
test
+
+
+ org.slf4j
+ slf4j-reload4j
+
+
org.easymock
diff --git a/kafka-rest/src/assembly/package.xml b/kafka-rest/src/assembly/package.xml
index 1a61dd2bf2..768a34db46 100644
--- a/kafka-rest/src/assembly/package.xml
+++ b/kafka-rest/src/assembly/package.xml
@@ -47,7 +47,7 @@
io.confluent:rest-utils
org.slf4j:slf4j-log4j12
- org.slf4j:slf4j-reload4j
+ org.apache.logging.log4j:log4j-slf4j-impl
@@ -55,7 +55,7 @@
false
true
- org.slf4j:slf4j-reload4j
+ org.apache.logging.log4j:log4j-slf4j-impl
diff --git a/kafka-rest/src/test/resources/log4j.properties b/kafka-rest/src/test/resources/log4j.properties
deleted file mode 100644
index 613a431401..0000000000
--- a/kafka-rest/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,15 +0,0 @@
-log4j.rootLogger=TRACE, stdout
-
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=[%d] %p %m (%c:%L)%n
-
-log4j.logger.kafka=ERROR
-log4j.logger.org.apache.kafka=ERROR
-
-# zkclient can be verbose, during debugging it is common to adjust is separately
-log4j.logger.org.I0Itec.zkclient=ERROR
-log4j.logger.org.apache.zookeeper=ERROR
-
-log4j.logger.org.eclipse=ERROR
-log4j.logger.org.hibernate.validator=ERROR
\ No newline at end of file
diff --git a/kafka-rest/src/test/resources/log4j2.yaml b/kafka-rest/src/test/resources/log4j2.yaml
new file mode 100644
index 0000000000..4fc0df1b18
--- /dev/null
+++ b/kafka-rest/src/test/resources/log4j2.yaml
@@ -0,0 +1,22 @@
+Configuration:
+ name: "Log4j2"
+ Appenders:
+ Console:
+ name: "STDOUT"
+ target: "SYSTEM_OUT"
+ PatternLayout:
+ pattern: "[%d] %v1Level %m (%c:%L)%n"
+ Loggers:
+ Root:
+ level: "TRACE"
+ AppenderRef:
+ ref: "STDOUT"
+ Logger:
+ - name: "kafka"
+ level: "ERROR"
+ - name: "org.apache.kafka"
+ level: "ERROR"
+ - name: "org.eclipse"
+ level: "ERROR"
+ - name: "org.hibernate.validator"
+ level: "ERROR"
diff --git a/licenses/NOTICE.confluent-common.txt b/licenses/NOTICE.confluent-common.txt
index b92ef9032d..8ec0261f03 100644
--- a/licenses/NOTICE.confluent-common.txt
+++ b/licenses/NOTICE.confluent-common.txt
@@ -6,6 +6,12 @@ The following libraries are included in packaged versions of this project:
* NOTICE: licenses/NOTICE.log4j.txt
* HOMEPAGE: http://logging.apache.org/log4j/1.2/
+* Apache Log4j
+ * COPYRIGHT: Copyright 1999-2024 Apache Software Foundation
+ * LICENSE: licenses/LICENSE.apache2.txt
+ * NOTICE: licenses/NOTICE.log4j2.txt
+ * HOMEPAGE: https://logging.apache.org/log4j/2.x/
+
* Apache ZooKeeper
* COPYRIGHT: Copyright 2009-2014 The Apache Software Foundation
* LICENSE: licenses/LICENSE.apache2.txt
diff --git a/licenses/NOTICE.confluent-schema-registry.txt b/licenses/NOTICE.confluent-schema-registry.txt
index c4b34db389..95277c0d54 100644
--- a/licenses/NOTICE.confluent-schema-registry.txt
+++ b/licenses/NOTICE.confluent-schema-registry.txt
@@ -24,6 +24,12 @@ The following libraries are included in packaged versions of this project:
* NOTICE: licenses/NOTICE.log4j.txt
* HOMEPAGE: http://logging.apache.org/log4j/1.2/
+* Apache Log4j
+ * COPYRIGHT: Copyright 1999-2024 Apache Software Foundation
+ * LICENSE: licenses/LICENSE.apache2.txt
+ * NOTICE: licenses/NOTICE.log4j2.txt
+ * HOMEPAGE: https://logging.apache.org/log4j/2.x/
+
* Apache ZooKeeper
* COPYRIGHT: Copyright 2009-2014 The Apache Software Foundation
* LICENSE: licenses/LICENSE.apache2.txt
diff --git a/licenses/NOTICE.log4j2.txt b/licenses/NOTICE.log4j2.txt
new file mode 100644
index 0000000000..0c37b52bfe
--- /dev/null
+++ b/licenses/NOTICE.log4j2.txt
@@ -0,0 +1,20 @@
+Apache Log4j
+Copyright 1999-2024 Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+ResolverUtil.java
+Copyright 2005-2006 Tim Fennell
+
+Dumbster SMTP test server
+Copyright 2004 Jason Paul Kitchen
+
+TypeUtil.java
+Copyright 2002-2012 Ramnivas Laddad, Juergen Hoeller, Chris Beams
+
+picocli (http://picocli.info)
+Copyright 2017 Remko Popma
+
+TimeoutBlockingWaitStrategy.java and parts of Util.java
+Copyright 2011 LMAX Ltd.