You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by st...@apache.org on 2022/06/23 06:43:59 UTC

[phoenix] branch master updated: PHOENIX-6695 Switch default logging backed to log4j2

This is an automated email from the ASF dual-hosted git repository.

stoty pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/master by this push:
     new c4dba44098 PHOENIX-6695 Switch default logging backed to log4j2
c4dba44098 is described below

commit c4dba440985e238f06c74ef3b1721d001358c182
Author: Istvan Toth <st...@apache.org>
AuthorDate: Tue Apr 26 14:45:38 2022 +0200

    PHOENIX-6695 Switch default logging backed to log4j2
---
 bin/log4j.properties                               |  76 ---------
 bin/log4j.xml                                      |  61 +++++++
 bin/phoenix_utils.py                               |   8 +-
 .../build/components/all-common-dependencies.xml   |   6 +-
 phoenix-client-parent/pom.xml                      |   1 +
 phoenix-core/pom.xml                               | 118 ++++++++++++-
 phoenix-core/src/it/resources/log4j.xml            |  49 ++++++
 phoenix-core/src/test/resources/log4j.xml          |  51 ++++++
 phoenix-pherf/config/log4j.properties              |  58 -------
 phoenix-pherf/config/log4j.xml                     |  51 ++++++
 phoenix-server/pom.xml                             |   9 +-
 phoenix-tracing-webapp/pom.xml                     |  17 +-
 pom.xml                                            | 183 ++++++++++++++++++++-
 13 files changed, 535 insertions(+), 153 deletions(-)

diff --git a/bin/log4j.properties b/bin/log4j.properties
deleted file mode 100644
index 2d007e1f3d..0000000000
--- a/bin/log4j.properties
+++ /dev/null
@@ -1,76 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you 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.
-#
-#
-
-# Define some default values that can be overridden by system properties
-psql.root.logger=WARN,console
-psql.log.dir=.
-psql.log.file=psql.log
-hadoop.log.dir=.
-
-# Define the root logger to the system property "plsql.root.logger".
-log4j.rootLogger=${psql.root.logger}
-
-# Logging Threshold to INFO for queryserver. root logger still at WARN for sqlline clients.
-log4j.threshold=INFO
-
-#
-# Daily Rolling File Appender
-#
-log4j.appender.DRFA=org.apache.log4j.DailyRollingFileAppender
-log4j.appender.DRFA.File=${psql.log.dir}/${psql.log.file}
-
-# Rollver at midnight
-log4j.appender.DRFA.DatePattern=.yyyy-MM-dd
-
-# 30-day backup
-#log4j.appender.DRFA.MaxBackupIndex=30
-log4j.appender.DRFA.layout=org.apache.log4j.PatternLayout
-
-# Pattern format: Date LogLevel LoggerName LogMessage
-log4j.appender.DRFA.layout.ConversionPattern=%d{ISO8601} %p %c: %m%n
-
-# Debugging Pattern format
-#log4j.appender.DRFA.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n
-
-#
-# Null Appender
-#
-log4j.appender.NullAppender=org.apache.log4j.varia.NullAppender
-
-#
-# console
-# Add "console" to rootlogger above if you want to use this 
-#
-log4j.appender.console=org.apache.log4j.ConsoleAppender
-log4j.appender.console.target=System.err
-log4j.appender.console.layout=org.apache.log4j.PatternLayout
-log4j.appender.console.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{2}: %m%n
-
-# Custom Logging levels
-log4j.logger.org.apache.zookeeper=ERROR
-log4j.logger.org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper=ERROR
-log4j.logger.org.apache.hadoop.hbase.zookeeper.ZKUtil=ERROR
-log4j.logger.org.apache.hadoop.hbase.HBaseConfiguration=ERROR
-
-# query server packages
-log4j.logger.org.apache.calcite.avatica=INFO
-log4j.logger.org.apache.phoenix.queryserver.server=INFO
-log4j.logger.org.eclipse.jetty.server=INFO
diff --git a/bin/log4j.xml b/bin/log4j.xml
new file mode 100644
index 0000000000..1d93814838
--- /dev/null
+++ b/bin/log4j.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" ?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you 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="Log4j1">
+  <Properties>
+    <Property name="hadoop.log.dir">.</Property>
+    <Property name="psql.log.dir">.</Property>
+    <Property name="psql.log.file">psql.log</Property>
+    <Property name="psql.root.logger">WARN,console</Property>
+  </Properties>
+  <ThresholdFilter onMatch="NEUTRAL" onMismatch="DENY"
+    level="INFO" />
+  <Appenders>
+    <Console name="console" target="SYSTEM_OUT">
+      <PatternLayout
+        pattern="%d{yy/MM/dd HH:mm:ss} %p %c{2}: %m%n" />
+    </Console>
+    <Null name="NullAppender" />
+    <RollingFile name="DRFA" fileName="./psql.log"
+      filePattern="./psql.log%d{.yyyy-MM-dd}">
+      <PatternLayout pattern="%d{ISO8601} %p %c: %m%n" />
+      <Policies>
+        <TimeBasedTriggeringPolicy
+          modulate="true" />
+      </Policies>
+      <DefaultRolloverStrategy max="2147483647" />
+    </RollingFile>
+  </Appenders>
+  <Loggers>
+    <Root level="WARN">
+      <AppenderRef ref="console" />
+    </Root>
+    <Logger name="org.apache.phoenix.queryserver.server"
+      level="INFO" />
+    <Logger name="org.apache.hadoop.hbase.zookeeper.ZKUtil"
+      level="ERROR" />
+    <Logger name="org.apache.calcite.avatica" level="INFO" />
+    <Logger name="org.apache.zookeeper" level="ERROR" />
+    <Logger name="org.eclipse.jetty.server" level="INFO" />
+    <Logger name="org.apache.hadoop.hbase.HBaseConfiguration"
+      level="ERROR" />
+    <Logger
+      name="org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper"
+      level="ERROR" />
+  </Loggers>
+</Configuration>
\ No newline at end of file
diff --git a/bin/phoenix_utils.py b/bin/phoenix_utils.py
index 012d09d9f7..de00f4efa9 100755
--- a/bin/phoenix_utils.py
+++ b/bin/phoenix_utils.py
@@ -81,8 +81,10 @@ def setPath():
     PHOENIX_TRACESERVER_JAR_PATTERN = "phoenix-tracing-webapp-*-runnable.jar"
     PHOENIX_TESTS_JAR_PATTERN = "phoenix-core-*-tests*.jar"
     PHOENIX_PHERF_JAR_PATTERN = "phoenix-pherf-*[!s].jar"
-    SLF4J_BACKEND_JAR_PATTERN = "slf4j-reload4j-*[!s].jar"
-    LOGGING_JAR_PATTERN = "reload4j-*[!s].jar"
+    SLF4J_BACKEND_JAR_PATTERN = "log4j-slf4j*.jar"
+    LOGGING_JAR_PATTERN = "log4j-core*.jar"
+    LOGGING_JAR_PATTERN2 = "log4j-api*.jar"
+    LOGGING_JAR_PATTERN3 = "log4j-1.2-api*.jar"
     SQLLINE_WITH_DEPS_PATTERN = "sqlline-*-jar-with-dependencies.jar"
 
 
@@ -184,6 +186,8 @@ def setPath():
     logging_jar = os.environ.get(OVERRIDE_LOGGING)
     if logging_jar is None or logging_jar == "":
         logging_jar = findFileInPathWithoutRecursion(LOGGING_JAR_PATTERN, os.path.join(current_dir, "..","lib"))
+        logging_jar += ":"+findFileInPathWithoutRecursion(LOGGING_JAR_PATTERN2, os.path.join(current_dir, "..","lib"))
+        logging_jar += ":"+findFileInPathWithoutRecursion(LOGGING_JAR_PATTERN3, os.path.join(current_dir, "..","lib"))
 
     return ""
 
diff --git a/phoenix-assembly/src/build/components/all-common-dependencies.xml b/phoenix-assembly/src/build/components/all-common-dependencies.xml
index 84fcd0a58d..4a5fd9bf86 100644
--- a/phoenix-assembly/src/build/components/all-common-dependencies.xml
+++ b/phoenix-assembly/src/build/components/all-common-dependencies.xml
@@ -24,8 +24,10 @@
       <outputDirectory>/lib</outputDirectory>
       <includes>
         <include>sqlline:sqlline:jar:jar-with-dependencies</include>
-        <include>org.slf4j:slf4j-reload4j</include>
-        <include>ch.qos.reload4j:reload4j</include>
+        <include>org.apache.logging.log4j:log4j-slf4j-impl</include>
+        <include>org.apache.logging.log4j:log4j-api</include>
+        <include>org.apache.logging.log4j:log4j-core</include>
+        <include>org.apache.logging.log4j:log4j-1.2-api</include>
       </includes>
     </dependencySet>
   </dependencySets>
diff --git a/phoenix-client-parent/pom.xml b/phoenix-client-parent/pom.xml
index af49cb3e47..584a253357 100644
--- a/phoenix-client-parent/pom.xml
+++ b/phoenix-client-parent/pom.xml
@@ -152,6 +152,7 @@
                   <exclude>org/slf4j/**</exclude>
                   <exclude>org/apache/commons/logging/**</exclude>
                   <exclude>org/apache/log4j/**</exclude>
+                  <exclude>org/apache/logging/log4j/**</exclude>
                   <!-- Not the org/ packages that are a part of the jdk -->
                   <exclude>org/ietf/jgss/**</exclude>
                   <exclude>org/omg/**</exclude>
diff --git a/phoenix-core/pom.xml b/phoenix-core/pom.xml
index 1e77bbe360..ffb3477a23 100644
--- a/phoenix-core/pom.xml
+++ b/phoenix-core/pom.xml
@@ -186,12 +186,20 @@
             <configuration>
               <artifactItems>
                 <artifactItem>
-                  <groupId>ch.qos.reload4j</groupId>
-                  <artifactId>reload4j</artifactId>
+                  <groupId>org.apache.logging.log4j</groupId>
+                  <artifactId>log4j-api</artifactId>
                 </artifactItem>
                 <artifactItem>
-                  <groupId>org.slf4j</groupId>
-                  <artifactId>slf4j-reload4j</artifactId>
+                  <groupId>org.apache.logging.log4j</groupId>
+                  <artifactId>log4j-core</artifactId>
+                </artifactItem>
+                <artifactItem>
+                  <groupId>org.apache.logging.log4j</groupId>
+                  <artifactId>log4j-slf4j-impl</artifactId>
+                </artifactItem>
+                <artifactItem>
+                  <groupId>org.apache.logging.log4j</groupId>
+                  <artifactId>log4j-1.2-api</artifactId>
                 </artifactItem>
                 <artifactItem>
                   <groupId>sqlline</groupId>
@@ -575,6 +583,106 @@
       <artifactId>hamcrest-core</artifactId>
       <scope>test</scope>
     </dependency>
-
   </dependencies>
+<profiles>
+  <profile>
+    <id>phoenix-hbase-compat-2.3.0</id>
+    <!-- keep dependency plugin happy -->
+    <activation>
+      <property>
+        <name>hbase.profile</name>
+        <value>2.3</value>
+      </property>
+    </activation>
+    <properties>
+      <hbase.profile>2.3</hbase.profile>
+    </properties>
+    <dependencies>
+      <dependency>
+        <groupId>ch.qos.reload4j</groupId>
+        <artifactId>reload4j</artifactId>
+        <scope>test</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.slf4j</groupId>
+        <artifactId>slf4j-reload4j</artifactId>
+        <scope>test</scope>
+      </dependency>
+    </dependencies>
+  </profile>
+  <profile>
+    <id>phoenix-hbase-compat-2.4.0</id>
+    <!-- keep dependency plugin happy -->
+    <activation>
+      <property>
+        <name>hbase.profile</name>
+        <value>2.4.0</value>
+      </property>
+    </activation>
+    <properties>
+      <hbase.profile>2.4.0</hbase.profile>
+    </properties>
+    <dependencies>
+      <dependency>
+        <groupId>ch.qos.reload4j</groupId>
+        <artifactId>reload4j</artifactId>
+        <scope>test</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.slf4j</groupId>
+        <artifactId>slf4j-reload4j</artifactId>
+        <scope>test</scope>
+      </dependency>
+    </dependencies>
+  </profile>
+  <profile>
+    <id>phoenix-hbase-compat-2.4.1</id>
+    <!-- keep dependency plugin happy -->
+    <activation>
+      <property>
+        <name>hbase.profile</name>
+        <value>2.4</value>
+      </property>
+    </activation>
+    <properties>
+      <hbase.profile>2.4</hbase.profile>
+    </properties>
+    <dependencies>
+      <dependency>
+        <groupId>ch.qos.reload4j</groupId>
+        <artifactId>reload4j</artifactId>
+        <scope>test</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.slf4j</groupId>
+        <artifactId>slf4j-reload4j</artifactId>
+        <scope>test</scope>
+      </dependency>
+    </dependencies>
+  </profile>
+  <profile>
+    <id>phoenix-hbase-compat-2.4.1-default</id>
+    <!-- keep dependency plugin happy -->
+    <activation>
+      <property>
+        <name>!hbase.profile</name>
+      </property>
+    </activation>
+    <properties>
+      <hbase.profile>2.4</hbase.profile>
+    </properties>
+    <dependencies>
+      <dependency>
+        <groupId>ch.qos.reload4j</groupId>
+        <artifactId>reload4j</artifactId>
+        <scope>test</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.slf4j</groupId>
+        <artifactId>slf4j-reload4j</artifactId>
+        <scope>test</scope>
+      </dependency>
+    </dependencies>
+  </profile>
+</profiles>
 </project>
diff --git a/phoenix-core/src/it/resources/log4j.xml b/phoenix-core/src/it/resources/log4j.xml
new file mode 100644
index 0000000000..3c021be5f7
--- /dev/null
+++ b/phoenix-core/src/it/resources/log4j.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" ?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you 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="Log4j1">
+  <Properties>
+    <Property name="hbase.log.dir">.</Property>
+    <Property name="hbase.log.file">hbase.log</Property>
+    <Property name="hbase.root.logger">DEBUG,console</Property>
+  </Properties>
+  <Appenders>
+    <Console name="console" target="SYSTEM_OUT">
+      <PatternLayout
+        pattern="%d %-5p [%t] %C{2}(%L): %m%n" />
+    </Console>
+    <RollingFile name="DRFA" fileName="./hbase.log"
+      filePattern="./hbase.log%d{.yyyy-MM-dd}">
+      <PatternLayout
+        pattern="%d %-5p [%t] %C{2}(%L): %m%n" />
+      <Policies>
+        <TimeBasedTriggeringPolicy
+          modulate="true" />
+      </Policies>
+      <DefaultRolloverStrategy max="2147483647" />
+    </RollingFile>
+  </Appenders>
+  <Loggers>
+    <Root level="DEBUG">
+      <AppenderRef ref="console" />
+    </Root>
+    <Logger name="org.apache.zookeeper" level="ERROR" />
+    <Logger name="org.apache.hadoop" level="WARN" />
+    <Logger name="org.apache.hadoop.hbase" level="DEBUG" />
+  </Loggers>
+</Configuration>
\ No newline at end of file
diff --git a/phoenix-core/src/test/resources/log4j.xml b/phoenix-core/src/test/resources/log4j.xml
new file mode 100644
index 0000000000..a7d890f28f
--- /dev/null
+++ b/phoenix-core/src/test/resources/log4j.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" ?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you 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="Log4j1">
+  <Properties>
+    <Property name="hbase.log.dir">.</Property>
+    <Property name="hbase.log.file">hbase.log</Property>
+    <Property name="hbase.root.logger">DEBUG,console</Property>
+  </Properties>
+  <Appenders>
+    <Console name="console" target="SYSTEM_OUT">
+      <PatternLayout pattern="%d %-5p [%t] %C(%L): %m%n" />
+    </Console>
+    <RollingFile name="DRFA" fileName="./hbase.log"
+      filePattern="./hbase.log%d{.yyyy-MM-dd}">
+      <PatternLayout
+        pattern="%d %-5p [%t] %C{2}(%L): %m%n" />
+      <Policies>
+        <TimeBasedTriggeringPolicy
+          modulate="true" />
+      </Policies>
+      <DefaultRolloverStrategy max="2147483647" />
+    </RollingFile>
+  </Appenders>
+  <Loggers>
+    <Root level="DEBUG">
+      <AppenderRef ref="console" />
+    </Root>
+    <Logger name="org.apache.hadoop.hbase" level="DEBUG" />
+    <Logger name="org.mortbay.log" level="WARN" />
+    <Logger name="org.apache.zookeeper" level="ERROR" />
+    <Logger name="net.sf.ehcache" level="WARN" />
+    <Logger name="org.apache.hadoop" level="WARN" />
+    <Logger name="org.apache.directory" level="WARN" />
+  </Loggers>
+</Configuration>
\ No newline at end of file
diff --git a/phoenix-pherf/config/log4j.properties b/phoenix-pherf/config/log4j.properties
deleted file mode 100644
index a6673c4494..0000000000
--- a/phoenix-pherf/config/log4j.properties
+++ /dev/null
@@ -1,58 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you 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,console
-log4j.threshold=INFO
-log4j.appender.DRFA=org.apache.log4j.DailyRollingFileAppender
-log4j.appender.DRFA.File=pherf.log
-
-# Rollver at midnight
-log4j.appender.DRFA.DatePattern=.yyyy-MM-dd
-
-# 30-day backup
-#log4j.appender.DRFA.MaxBackupIndex=30
-log4j.appender.DRFA.layout=org.apache.log4j.PatternLayout
-
-# Pattern format: Date LogLevel LoggerName LogMessage
-log4j.appender.DRFA.layout.ConversionPattern=%d{ISO8601} %p %c: %m%n
-
-# Debugging Pattern format
-#log4j.appender.DRFA.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n
-
-#
-# Null Appender
-#
-log4j.appender.NullAppender=org.apache.log4j.varia.NullAppender
-
-#
-# console
-# Add "console" to rootlogger above if you want to use this 
-#
-log4j.appender.console=org.apache.log4j.ConsoleAppender
-log4j.appender.console.target=System.err
-log4j.appender.console.layout=org.apache.log4j.PatternLayout
-log4j.appender.console.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{2}: %m%n
-
-# Custom Logging levels
-log4j.logger.org.apache.zookeeper=ERROR
-log4j.logger.org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper=ERROR
-log4j.logger.org.apache.hadoop.hbase.zookeeper.ZKUtil=ERROR
-log4j.logger.org.apache.hadoop.hbase.HBaseConfiguration=ERROR
diff --git a/phoenix-pherf/config/log4j.xml b/phoenix-pherf/config/log4j.xml
new file mode 100644
index 0000000000..a9526f4c96
--- /dev/null
+++ b/phoenix-pherf/config/log4j.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" ?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you 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="Log4j1">
+  <ThresholdFilter onMatch="NEUTRAL" onMismatch="DENY"
+    level="INFO" />
+  <Appenders>
+    <Console name="console" target="SYSTEM_OUT">
+      <PatternLayout
+        pattern="%d{yy/MM/dd HH:mm:ss} %p %c{2}: %m%n" />
+    </Console>
+    <Null name="NullAppender" />
+    <RollingFile name="DRFA" fileName="pherf.log"
+      filePattern="pherf.log%d{.yyyy-MM-dd}">
+      <PatternLayout pattern="%d{ISO8601} %p %c: %m%n" />
+      <Policies>
+        <TimeBasedTriggeringPolicy
+          modulate="true" />
+      </Policies>
+      <DefaultRolloverStrategy max="2147483647" />
+    </RollingFile>
+  </Appenders>
+  <Loggers>
+    <Root level="INFO">
+      <AppenderRef ref="console" />
+    </Root>
+    <Logger name="org.apache.hadoop.hbase.zookeeper.ZKUtil"
+      level="ERROR" />
+    <Logger name="org.apache.zookeeper" level="ERROR" />
+    <Logger name="org.apache.hadoop.hbase.HBaseConfiguration"
+      level="ERROR" />
+    <Logger
+      name="org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper"
+      level="ERROR" />
+  </Loggers>
+</Configuration>
\ No newline at end of file
diff --git a/phoenix-server/pom.xml b/phoenix-server/pom.xml
index dc62e14c81..f87941dceb 100644
--- a/phoenix-server/pom.xml
+++ b/phoenix-server/pom.xml
@@ -116,11 +116,10 @@
                         <exclude>org.eclipse.jetty:*</exclude>
                         <exclude>org.apache.phoenix:phoenix-server</exclude>
                         <exclude>sqlline:sqlline</exclude>
-                        <exclude>log4j:log4j</exclude>
-                        <exclude>ch.qos.reload4j:reload4j</exclude>
-                        <exclude>org.slf4j:slf4j-api</exclude>
-                        <exclude>org.slf4j:slf4j-log4j12</exclude>
-                        <exclude>org.slf4j:slf4j-reload4j</exclude>
+                        <exclude>log4j:*</exclude>
+                        <exclude>ch.qos.reload4j:*</exclude>
+                        <exclude>org.slf4j:*</exclude>
+                        <exclude>org.apache.logging.log4j:*</exclude>
                     </excludes>
                 </artifactSet>
                 <filters>
diff --git a/phoenix-tracing-webapp/pom.xml b/phoenix-tracing-webapp/pom.xml
index 376640359e..882cf192ac 100755
--- a/phoenix-tracing-webapp/pom.xml
+++ b/phoenix-tracing-webapp/pom.xml
@@ -62,9 +62,20 @@
         <artifactId>slf4j-api</artifactId>
       </dependency>
       <dependency>
-        <groupId>ch.qos.reload4j</groupId>
-        <artifactId>reload4j</artifactId>
-        <scope>compile</scope>
+        <groupId>org.apache.logging.log4j</groupId>
+        <artifactId>log4j-api</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.logging.log4j</groupId>
+        <artifactId>log4j-core</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.logging.log4j</groupId>
+        <artifactId>log4j-slf4j-impl</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.logging.log4j</groupId>
+        <artifactId>log4j-1.2-api</artifactId>
       </dependency>
       <dependency>
         <groupId>org.apache.phoenix</groupId>
diff --git a/pom.xml b/pom.xml
index 5fa65a6d26..dce00aaee1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -95,7 +95,9 @@
     <!-- Dependency versions -->
     <jackson-bom.version>2.12.6.20220326</jackson-bom.version>
     <antlr.version>3.5.2</antlr.version>
+    <!-- Only used for tests with HBase 2.1-2.4 -->
     <reload4j.version>1.2.19</reload4j.version>
+    <log4j2.version>2.17.2</log4j2.version>
     <disruptor.version>3.3.6</disruptor.version>
     <slf4j.version>1.7.36</slf4j.version>
     <!-- com.google repo will be used except on Aarch64 platform. -->
@@ -380,6 +382,9 @@
                 <ignoredUnusedDeclaredDependency>
                   org.slf4j:slf4j-reload4j
                 </ignoredUnusedDeclaredDependency>
+                <ignoredUnusedDeclaredDependency>
+                  ch.qos.reload4j:reload4j
+                </ignoredUnusedDeclaredDependency>
                 <ignoredUnusedDeclaredDependency>
                   org.apache.hbase:hbase-testing-util
                 </ignoredUnusedDeclaredDependency>
@@ -745,12 +750,30 @@
             <groupId>org.apache.htrace</groupId>
             <artifactId>htrace-core4</artifactId>
           </exclusion>
+          <exclusion>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+          </exclusion>
         </exclusions>
       </dependency>
       <dependency>
         <groupId>org.apache.hadoop</groupId>
         <artifactId>hadoop-mapreduce-client-core</artifactId>
         <version>${hadoop.version}</version>
+        <exclusions>
+          <exclusion>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+          </exclusion>
+        </exclusions>
       </dependency>
       <dependency>
         <groupId>org.apache.hadoop</groupId>
@@ -778,6 +801,16 @@
         <groupId>org.apache.hadoop</groupId>
         <artifactId>hadoop-hdfs</artifactId>
         <version>${hadoop.version}</version>
+        <exclusions>
+          <exclusion>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+          </exclusion>
+        </exclusions>
       </dependency>
       <dependency>
         <groupId>org.apache.hadoop</groupId>
@@ -795,6 +828,14 @@
             <groupId>org.ow2.asm</groupId>
             <artifactId>asm</artifactId>
           </exclusion>
+          <exclusion>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+          </exclusion>
         </exclusions>
         <version>${hadoop.version}</version>
       </dependency>
@@ -818,6 +859,16 @@
         <artifactId>hadoop-minikdc</artifactId>
         <version>${hadoop.version}</version>
         <scope>test</scope>
+        <exclusions>
+          <exclusion>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+          </exclusion>
+        </exclusions>
       </dependency>
       <dependency>
         <groupId>org.apache.hadoop</groupId>
@@ -831,6 +882,14 @@
             <groupId>org.apache.htrace</groupId>
             <artifactId>htrace-core4</artifactId>
           </exclusion>
+          <exclusion>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+          </exclusion>
         </exclusions>
       </dependency>
 
@@ -868,6 +927,16 @@
         <groupId>org.apache.hbase</groupId>
         <artifactId>hbase-common</artifactId>
         <version>${hbase.version}</version>
+        <exclusions>
+          <exclusion>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+          </exclusion>
+        </exclusions>
       </dependency>
       <dependency>
         <groupId>org.apache.hbase</groupId>
@@ -898,12 +967,30 @@
             <groupId>xom</groupId>
             <artifactId>xom</artifactId>
           </exclusion>
+          <exclusion>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+          </exclusion>
         </exclusions>
       </dependency>
       <dependency>
         <groupId>org.apache.hbase</groupId>
         <artifactId>hbase-mapreduce</artifactId>
         <version>${hbase.version}</version>
+        <exclusions>
+          <exclusion>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+          </exclusion>
+        </exclusions>
       </dependency>
       <dependency>
         <groupId>org.apache.hbase</groupId>
@@ -919,6 +1006,12 @@
         <groupId>org.apache.hbase</groupId>
         <artifactId>hbase-zookeeper</artifactId>
         <version>${hbase.version}</version>
+        <exclusions>
+          <exclusion>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+          </exclusion>
+        </exclusions>
       </dependency>
 
       <dependency>
@@ -944,6 +1037,14 @@
             <groupId>org.jruby</groupId>
             <artifactId>jruby-complete</artifactId>
           </exclusion>
+          <exclusion>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+          </exclusion>
         </exclusions>
       </dependency>
       <dependency>
@@ -952,6 +1053,12 @@
         <version>${hbase.version}</version>
         <type>test-jar</type>
         <scope>test</scope>
+        <exclusions>
+          <exclusion>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+          </exclusion>
+        </exclusions>
       </dependency>
       <dependency>
         <groupId>org.apache.hbase</groupId>
@@ -959,6 +1066,16 @@
         <version>${hbase.version}</version>
         <type>test-jar</type>
         <scope>test</scope>
+        <exclusions>
+          <exclusion>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+          </exclusion>
+        </exclusions>
       </dependency>
 
       <!-- Transaction dependencies -->
@@ -1136,6 +1253,14 @@
             <groupId>commons-daemon</groupId>
             <artifactId>commons-daemon</artifactId>
           </exclusion>
+          <exclusion>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+          </exclusion>
         </exclusions>
       </dependency>
       <dependency>
@@ -1183,6 +1308,14 @@
             <groupId>commons-daemon</groupId>
             <artifactId>commons-daemon</artifactId>
           </exclusion>
+          <exclusion>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+          </exclusion>
         </exclusions>
       </dependency>
       <dependency>
@@ -1248,6 +1381,14 @@
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
           </exclusion>
+          <exclusion>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+          </exclusion>
         </exclusions>
       </dependency>
       <dependency>
@@ -1298,6 +1439,16 @@
         <artifactId>hbase-testing-util</artifactId>
         <version>${hbase.version}</version>
         <scope>test</scope>
+        <exclusions>
+          <exclusion>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+          </exclusion>
+        </exclusions>
       </dependency>
 
       <!-- Other dependencies -->
@@ -1305,6 +1456,16 @@
         <groupId>org.apache.zookeeper</groupId>
         <artifactId>zookeeper</artifactId>
         <version>${zookeeper.version}</version>
+        <exclusions>
+          <exclusion>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+          </exclusion>
+        </exclusions>
       </dependency>
       <dependency>
         <groupId>org.apache.zookeeper</groupId>
@@ -1465,13 +1626,31 @@
         <groupId>ch.qos.reload4j</groupId>
         <artifactId>reload4j</artifactId>
         <version>${reload4j.version}</version>
-        <scope>runtime</scope>
       </dependency>
       <dependency>
         <groupId>org.slf4j</groupId>
         <artifactId>slf4j-reload4j</artifactId>
         <version>${slf4j.version}</version>
-        <scope>runtime</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.logging.log4j</groupId>
+        <artifactId>log4j-api</artifactId>
+        <version>${log4j2.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.logging.log4j</groupId>
+        <artifactId>log4j-core</artifactId>
+        <version>${log4j2.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.logging.log4j</groupId>
+        <artifactId>log4j-slf4j-impl</artifactId>
+        <version>${log4j2.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.logging.log4j</groupId>
+        <artifactId>log4j-1.2-api</artifactId>
+        <version>${log4j2.version}</version>
       </dependency>
       <dependency>
         <groupId>sqlline</groupId>