From 2ed8031fec2a212fd1a76068acf925cef7f7f1d1 Mon Sep 17 00:00:00 2001 From: Shubhankar Ranade Date: Tue, 1 Apr 2025 19:34:49 +0530 Subject: [PATCH 1/5] Upgrade log4j1 to log4j2 --- core/pom.xml | 4 ++-- examples/pom.xml | 4 ++-- fips-tests/pom.xml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/pom.xml b/core/pom.xml index d92b7cdc98..7bf4af613a 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -226,8 +226,8 @@ test - org.slf4j - slf4j-reload4j + org.apache.logging.log4j + log4j-slf4j-impl test diff --git a/examples/pom.xml b/examples/pom.xml index 8defebceb7..d9655161ad 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -30,8 +30,8 @@ - org.slf4j - slf4j-reload4j + org.apache.logging.log4j + log4j-slf4j-impl io.confluent diff --git a/fips-tests/pom.xml b/fips-tests/pom.xml index fe029a216e..996a1d26b6 100644 --- a/fips-tests/pom.xml +++ b/fips-tests/pom.xml @@ -20,8 +20,8 @@ ${io.confluent.rest-utils.version} - org.slf4j - slf4j-reload4j + org.apache.logging.log4j + log4j-slf4j-impl test From cb4afee764695330ae1c9a5b7bfc81831106aceb Mon Sep 17 00:00:00 2001 From: Shubhankar Ranade Date: Wed, 2 Apr 2025 13:54:13 +0530 Subject: [PATCH 2/5] Migrate log4j1 configuration files --- core/src/test/resources/log4j.properties | 21 ------------- core/src/test/resources/log4j2.xml | 30 ++++++++++++++++++ examples/src/main/resources/log4j.properties | 12 ------- examples/src/main/resources/log4j2.xml | 31 +++++++++++++++++++ .../src/test/resources/log4j.properties | 21 ------------- fips-tests/src/test/resources/log4j2.xml | 30 ++++++++++++++++++ 6 files changed, 91 insertions(+), 54 deletions(-) delete mode 100644 core/src/test/resources/log4j.properties create mode 100644 core/src/test/resources/log4j2.xml delete mode 100644 examples/src/main/resources/log4j.properties create mode 100644 examples/src/main/resources/log4j2.xml delete mode 100644 fips-tests/src/test/resources/log4j.properties create mode 100644 fips-tests/src/test/resources/log4j2.xml diff --git a/core/src/test/resources/log4j.properties b/core/src/test/resources/log4j.properties deleted file mode 100644 index 9017d70573..0000000000 --- a/core/src/test/resources/log4j.properties +++ /dev/null @@ -1,21 +0,0 @@ -## -# Copyright 2015 Confluent Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -## - -log4j.rootLogger=INFO, 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 diff --git a/core/src/test/resources/log4j2.xml b/core/src/test/resources/log4j2.xml new file mode 100644 index 0000000000..18ba6bbb5b --- /dev/null +++ b/core/src/test/resources/log4j2.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + diff --git a/examples/src/main/resources/log4j.properties b/examples/src/main/resources/log4j.properties deleted file mode 100644 index 61d5c9893e..0000000000 --- a/examples/src/main/resources/log4j.properties +++ /dev/null @@ -1,12 +0,0 @@ -log4j.rootLogger=INFO, 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=OFF, stdout -log4j.logger.org.apache.zookeeper=ERROR, stdout -log4j.logger.org.apache.kafka=ERROR, stdout -log4j.logger.org.I0Itec.zkclient=ERROR, stdout -#log4j.logger.kafka.consumer.ZookeeperConsumerConnector=INFO, stdout -log4j.additivity.kafka.server=false -log4j.additivity.kafka.consumer.ZookeeperConsumerConnector=false -log4j.logger.io.confluent.rest-utils.requests=INFO, stdout \ No newline at end of file diff --git a/examples/src/main/resources/log4j2.xml b/examples/src/main/resources/log4j2.xml new file mode 100644 index 0000000000..492c76b24e --- /dev/null +++ b/examples/src/main/resources/log4j2.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/fips-tests/src/test/resources/log4j.properties b/fips-tests/src/test/resources/log4j.properties deleted file mode 100644 index 91b2fb1e10..0000000000 --- a/fips-tests/src/test/resources/log4j.properties +++ /dev/null @@ -1,21 +0,0 @@ -## -# Copyright 2023 Confluent Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -## - -log4j.rootLogger=INFO, 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 diff --git a/fips-tests/src/test/resources/log4j2.xml b/fips-tests/src/test/resources/log4j2.xml new file mode 100644 index 0000000000..14f0c1ca1c --- /dev/null +++ b/fips-tests/src/test/resources/log4j2.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + From abb70d16b21f3318cbcd436af7e253bf8cce512b Mon Sep 17 00:00:00 2001 From: Shubhankar Ranade Date: Wed, 2 Apr 2025 14:37:01 +0530 Subject: [PATCH 3/5] Update license --- licenses/NOTICE.confluent-common.txt | 6 ++++++ licenses/NOTICE.log4j2.txt | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 licenses/NOTICE.log4j2.txt diff --git a/licenses/NOTICE.confluent-common.txt b/licenses/NOTICE.confluent-common.txt index 98f9dd4c05..4dddd38bdf 100644 --- a/licenses/NOTICE.confluent-common.txt +++ b/licenses/NOTICE.confluent-common.txt @@ -16,6 +16,12 @@ The following libraries are included in packaged versions of this project: * LICENSE: licenses/LICENSE.mit.txt * HOMEPAGE: http://www.slf4j.org/ +* 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/ + * ZkClient * LICENSE: licenses/LICENSE.apache2.txt * HOMEPAGE: https://github.com/sgroschupf/zkclient 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. From d3eb498eedc1d447ace3ab002000ea9b4c1ac9e8 Mon Sep 17 00:00:00 2001 From: Shubhankar Ranade Date: Wed, 2 Apr 2025 16:20:39 +0530 Subject: [PATCH 4/5] Use yaml configs instead of xml --- core/src/test/resources/log4j2.xml | 30 ---------------------- core/src/test/resources/log4j2.yaml | 28 ++++++++++++++++++++ examples/src/main/resources/log4j2.xml | 31 ----------------------- examples/src/main/resources/log4j2.yaml | 30 ++++++++++++++++++++++ fips-tests/src/test/resources/log4j2.xml | 30 ---------------------- fips-tests/src/test/resources/log4j2.yaml | 28 ++++++++++++++++++++ 6 files changed, 86 insertions(+), 91 deletions(-) delete mode 100644 core/src/test/resources/log4j2.xml create mode 100644 core/src/test/resources/log4j2.yaml delete mode 100644 examples/src/main/resources/log4j2.xml create mode 100644 examples/src/main/resources/log4j2.yaml delete mode 100644 fips-tests/src/test/resources/log4j2.xml create mode 100644 fips-tests/src/test/resources/log4j2.yaml diff --git a/core/src/test/resources/log4j2.xml b/core/src/test/resources/log4j2.xml deleted file mode 100644 index 18ba6bbb5b..0000000000 --- a/core/src/test/resources/log4j2.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/core/src/test/resources/log4j2.yaml b/core/src/test/resources/log4j2.yaml new file mode 100644 index 0000000000..8ea8fc60d8 --- /dev/null +++ b/core/src/test/resources/log4j2.yaml @@ -0,0 +1,28 @@ +# +#Copyright 2015 Confluent Inc. +# +#Licensed under the Apache License, Version 2.0 (the "License"); +#you may not use this file except in compliance with the License. +#You may obtain a copy of the License at +# +#http://www.apache.org/licenses/LICENSE-2.0 +# +#Unless required by applicable law or agreed to in writing, software +#distributed under the License is distributed on an "AS IS" BASIS, +#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +#See the License for the specific language governing permissions and +#limitations under the License. +# +Configuration: + name: "Log4j2" + Appenders: + Console: + name: "STDOUT" + target: "SYSTEM_OUT" + PatternLayout: + pattern: "[%d] %v1Level %m (%c:%L)%n" + Loggers: + Root: + level: "INFO" + AppenderRef: + ref: "STDOUT" diff --git a/examples/src/main/resources/log4j2.xml b/examples/src/main/resources/log4j2.xml deleted file mode 100644 index 492c76b24e..0000000000 --- a/examples/src/main/resources/log4j2.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/src/main/resources/log4j2.yaml b/examples/src/main/resources/log4j2.yaml new file mode 100644 index 0000000000..5d9762d1fa --- /dev/null +++ b/examples/src/main/resources/log4j2.yaml @@ -0,0 +1,30 @@ +Configuration: + name: "Log4j2" + Appenders: + Console: + name: "STDOUT" + target: "SYSTEM_OUT" + PatternLayout: + pattern: "[%d] %v1Level %m (%c:%L)%n" + Loggers: + Root: + level: "INFO" + AppenderRef: + ref: "STDOUT" + Logger: + - name: "org.apache.kafka" + level: "ERROR" + AppenderRef: + ref: "STDOUT" + - name: "org.I0Itec.zkclient" + level: "ERROR" + AppenderRef: + ref: "STDOUT" + - name: "io.confluent.rest-utils.requests" + level: "INFO" + AppenderRef: + ref: "STDOUT" + - name: "kafka" + level: "OFF" + AppenderRef: + ref: "STDOUT" diff --git a/fips-tests/src/test/resources/log4j2.xml b/fips-tests/src/test/resources/log4j2.xml deleted file mode 100644 index 14f0c1ca1c..0000000000 --- a/fips-tests/src/test/resources/log4j2.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/fips-tests/src/test/resources/log4j2.yaml b/fips-tests/src/test/resources/log4j2.yaml new file mode 100644 index 0000000000..4056b0236a --- /dev/null +++ b/fips-tests/src/test/resources/log4j2.yaml @@ -0,0 +1,28 @@ +# +# Copyright 2023 Confluent Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +Configuration: + name: "Log4j2" + Appenders: + Console: + name: "STDOUT" + target: "SYSTEM_OUT" + PatternLayout: + pattern: "[%d] %v1Level %m (%c:%L)%n" + Loggers: + Root: + level: "INFO" + AppenderRef: + ref: "STDOUT" From 16b7d3bb1049e28c2ee888322632c92fc0aa0479 Mon Sep 17 00:00:00 2001 From: Shubhankar Ranade Date: Thu, 3 Apr 2025 13:52:04 +0530 Subject: [PATCH 5/5] Dependency for log4j yaml config --- core/pom.xml | 5 +++++ core/src/test/resources/log4j2.yaml | 24 +++++++++++------------ examples/pom.xml | 5 +++++ fips-tests/pom.xml | 5 +++++ fips-tests/src/test/resources/log4j2.yaml | 4 ++-- 5 files changed, 29 insertions(+), 14 deletions(-) diff --git a/core/pom.xml b/core/pom.xml index 7bf4af613a..81c9d4b3ca 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -102,6 +102,11 @@ com.fasterxml.jackson.core jackson-databind + + com.fasterxml.jackson.dataformat + jackson-dataformat-yaml + test + com.fasterxml.jackson.jakarta.rs jackson-jakarta-rs-json-provider diff --git a/core/src/test/resources/log4j2.yaml b/core/src/test/resources/log4j2.yaml index 8ea8fc60d8..ffe624714b 100644 --- a/core/src/test/resources/log4j2.yaml +++ b/core/src/test/resources/log4j2.yaml @@ -1,18 +1,18 @@ +## +# Copyright 2015 Confluent Inc. # -#Copyright 2015 Confluent Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -#Licensed under the Apache License, Version 2.0 (the "License"); -#you may not use this file except in compliance with the License. -#You may obtain a copy of the License at -# -#http://www.apache.org/licenses/LICENSE-2.0 -# -#Unless required by applicable law or agreed to in writing, software -#distributed under the License is distributed on an "AS IS" BASIS, -#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -#See the License for the specific language governing permissions and -#limitations under the License. +# http://www.apache.org/licenses/LICENSE-2.0 # +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +## Configuration: name: "Log4j2" Appenders: diff --git a/examples/pom.xml b/examples/pom.xml index d9655161ad..4a68d0acad 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -33,6 +33,11 @@ org.apache.logging.log4j log4j-slf4j-impl + + com.fasterxml.jackson.dataformat + jackson-dataformat-yaml + runtime + io.confluent logredactor diff --git a/fips-tests/pom.xml b/fips-tests/pom.xml index 996a1d26b6..1d0a52acdb 100644 --- a/fips-tests/pom.xml +++ b/fips-tests/pom.xml @@ -24,6 +24,11 @@ log4j-slf4j-impl test + + com.fasterxml.jackson.dataformat + jackson-dataformat-yaml + test + org.junit.jupiter junit-jupiter diff --git a/fips-tests/src/test/resources/log4j2.yaml b/fips-tests/src/test/resources/log4j2.yaml index 4056b0236a..15a87eb2a6 100644 --- a/fips-tests/src/test/resources/log4j2.yaml +++ b/fips-tests/src/test/resources/log4j2.yaml @@ -1,4 +1,4 @@ -# +## # Copyright 2023 Confluent Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,7 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# +## Configuration: name: "Log4j2" Appenders: