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

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


The following commit(s) were added to refs/heads/master by this push:
     new f4e73310b [Hotfix] Change log4j impl dependency to `log4j-slf4j2-impl` 
(#4336)
f4e73310b is described below

commit f4e73310b58b56bac325cbb5665fd509b59cc188
Author: ZhouJinsong <[email protected]>
AuthorDate: Wed Aug 26 16:23:18 2026 +0800

    [Hotfix] Change log4j impl dependency to `log4j-slf4j2-impl` (#4336)
    
    * Change log4j impl to log4j-slf4j2-impl
    
    * Fix dependencies information
    
    * Fix mixed-trino ci issue
    
    * Fix log4j dependency conflicts
    
    * Fix log4j dependencies
    
    * Change enforcer to verify phase
    
    * Fix checkstyle issue in pom
    
    * Fix unit test issues for spark 3.3
    
    * Fix log4j conflicts in mixed trino
    
    * Fix log dependency conflicts in hudi moduel
---
 amoro-ams/pom.xml                                  | 19 +++++++++-
 amoro-format-hudi/pom.xml                          |  4 +++
 .../amoro-mixed-spark-3-common/pom.xml             | 12 +++++++
 .../v3.3/amoro-mixed-spark-3.3/pom.xml             | 17 +++++++++
 .../v3.4/amoro-mixed-spark-3.4/pom.xml             |  8 +++++
 .../v3.5/amoro-mixed-spark-3.5/pom.xml             |  8 +++++
 amoro-format-mixed/amoro-mixed-trino/pom.xml       | 14 ++++++++
 amoro-format-paimon/pom.xml                        | 10 ++++++
 amoro-optimizer/amoro-optimizer-spark/pom.xml      |  8 +++++
 amoro-optimizer/amoro-optimizer-standalone/pom.xml |  2 +-
 dev/deps/dependencies-hadoop-2-spark-3.3           |  2 +-
 dev/deps/dependencies-hadoop-3-spark-3.5           |  2 +-
 pom.xml                                            | 42 +++++++++++++++++++++-
 13 files changed, 143 insertions(+), 5 deletions(-)

diff --git a/amoro-ams/pom.xml b/amoro-ams/pom.xml
index af6fa6bb6..4e1a8bcf0 100644
--- a/amoro-ams/pom.xml
+++ b/amoro-ams/pom.xml
@@ -109,6 +109,10 @@
                     <groupId>org.rocksdb</groupId>
                     <artifactId>rocksdbjni</artifactId>
                 </exclusion>
+                <exclusion>
+                    <groupId>org.apache.logging.log4j</groupId>
+                    <artifactId>log4j-slf4j-impl</artifactId>
+                </exclusion>
             </exclusions>
         </dependency>
 
@@ -149,6 +153,10 @@
                     <groupId>com.fasterxml.jackson.core</groupId>
                     <artifactId>*</artifactId>
                 </exclusion>
+                <exclusion>
+                    <groupId>org.apache.logging.log4j</groupId>
+                    <artifactId>log4j-slf4j-impl</artifactId>
+                </exclusion>
             </exclusions>
         </dependency>
 
@@ -266,9 +274,14 @@
             <artifactId>javalin</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+
         <dependency>
             <groupId>org.apache.logging.log4j</groupId>
-            <artifactId>log4j-slf4j-impl</artifactId>
+            <artifactId>log4j-slf4j2-impl</artifactId>
         </dependency>
 
         <dependency>
@@ -541,6 +554,10 @@
                     <groupId>org.apache.directory.jdbm</groupId>
                     <artifactId>apacheds-jdbm1</artifactId>
                 </exclusion>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-log4j12</artifactId>
+                </exclusion>
             </exclusions>
         </dependency>
     </dependencies>
diff --git a/amoro-format-hudi/pom.xml b/amoro-format-hudi/pom.xml
index 7e40a2695..5c3e481f5 100644
--- a/amoro-format-hudi/pom.xml
+++ b/amoro-format-hudi/pom.xml
@@ -52,6 +52,10 @@
                     <groupId>asm</groupId>
                     <artifactId>asm</artifactId>
                 </exclusion>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-log4j12</artifactId>
+                </exclusion>
             </exclusions>
         </dependency>
     </dependencies>
diff --git 
a/amoro-format-mixed/amoro-mixed-spark/amoro-mixed-spark-3-common/pom.xml 
b/amoro-format-mixed/amoro-mixed-spark/amoro-mixed-spark-3-common/pom.xml
index ad5668c54..28f9303b0 100644
--- a/amoro-format-mixed/amoro-mixed-spark/amoro-mixed-spark-3-common/pom.xml
+++ b/amoro-format-mixed/amoro-mixed-spark/amoro-mixed-spark-3-common/pom.xml
@@ -83,6 +83,10 @@
                     <groupId>org.apache.arrow</groupId>
                     <artifactId>arrow-vector</artifactId>
                 </exclusion>
+                <exclusion>
+                    <groupId>org.apache.logging.log4j</groupId>
+                    <artifactId>log4j-slf4j-impl</artifactId>
+                </exclusion>
             </exclusions>
         </dependency>
 
@@ -134,6 +138,14 @@
                     <groupId>log4j</groupId>
                     <artifactId>log4j</artifactId>
                 </exclusion>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-log4j12</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.apache.logging.log4j</groupId>
+                    <artifactId>log4j-slf4j-impl</artifactId>
+                </exclusion>
             </exclusions>
         </dependency>
 
diff --git 
a/amoro-format-mixed/amoro-mixed-spark/v3.3/amoro-mixed-spark-3.3/pom.xml 
b/amoro-format-mixed/amoro-mixed-spark/v3.3/amoro-mixed-spark-3.3/pom.xml
index 9de260a8a..eee28a02f 100644
--- a/amoro-format-mixed/amoro-mixed-spark/v3.3/amoro-mixed-spark-3.3/pom.xml
+++ b/amoro-format-mixed/amoro-mixed-spark/v3.3/amoro-mixed-spark-3.3/pom.xml
@@ -89,6 +89,10 @@
                     <groupId>org.apache.orc</groupId>
                     <artifactId>orc-mapreduce</artifactId>
                 </exclusion>
+                <exclusion>
+                    <groupId>org.apache.logging.log4j</groupId>
+                    <artifactId>log4j-slf4j-impl</artifactId>
+                </exclusion>
             </exclusions>
         </dependency>
 
@@ -126,6 +130,10 @@
                     <groupId>org.apache.arrow</groupId>
                     <artifactId>arrow-vector</artifactId>
                 </exclusion>
+                <exclusion>
+                    <groupId>org.apache.logging.log4j</groupId>
+                    <artifactId>log4j-slf4j-impl</artifactId>
+                </exclusion>
             </exclusions>
         </dependency>
 
@@ -383,6 +391,15 @@
             <classifier>core</classifier>
             <scope>test</scope>
         </dependency>
+
+        <!-- Spark 3.3's Logging trait directly references 
org.slf4j.impl.StaticLoggerBinder
+             (hard bytecode dependency, fixed in Spark 3.4+ via reflection). 
This SLF4J 1.x
+             binding is inert for SLF4J 2.x code paths but provides the class 
Spark needs. -->
+        <dependency>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-slf4j-impl</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <build>
diff --git 
a/amoro-format-mixed/amoro-mixed-spark/v3.4/amoro-mixed-spark-3.4/pom.xml 
b/amoro-format-mixed/amoro-mixed-spark/v3.4/amoro-mixed-spark-3.4/pom.xml
index e4f3b5644..2854dfa48 100644
--- a/amoro-format-mixed/amoro-mixed-spark/v3.4/amoro-mixed-spark-3.4/pom.xml
+++ b/amoro-format-mixed/amoro-mixed-spark/v3.4/amoro-mixed-spark-3.4/pom.xml
@@ -89,6 +89,10 @@
                     <groupId>org.apache.orc</groupId>
                     <artifactId>orc-mapreduce</artifactId>
                 </exclusion>
+                <exclusion>
+                    <groupId>org.apache.logging.log4j</groupId>
+                    <artifactId>log4j-slf4j-impl</artifactId>
+                </exclusion>
             </exclusions>
         </dependency>
 
@@ -130,6 +134,10 @@
                     <groupId>org.apache.arrow</groupId>
                     <artifactId>arrow-vector</artifactId>
                 </exclusion>
+                <exclusion>
+                    <groupId>org.apache.logging.log4j</groupId>
+                    <artifactId>log4j-slf4j-impl</artifactId>
+                </exclusion>
             </exclusions>
         </dependency>
 
diff --git 
a/amoro-format-mixed/amoro-mixed-spark/v3.5/amoro-mixed-spark-3.5/pom.xml 
b/amoro-format-mixed/amoro-mixed-spark/v3.5/amoro-mixed-spark-3.5/pom.xml
index e03c59f3c..d3889f193 100644
--- a/amoro-format-mixed/amoro-mixed-spark/v3.5/amoro-mixed-spark-3.5/pom.xml
+++ b/amoro-format-mixed/amoro-mixed-spark/v3.5/amoro-mixed-spark-3.5/pom.xml
@@ -89,6 +89,10 @@
                     <groupId>org.apache.orc</groupId>
                     <artifactId>orc-mapreduce</artifactId>
                 </exclusion>
+                <exclusion>
+                    <groupId>org.apache.logging.log4j</groupId>
+                    <artifactId>log4j-slf4j-impl</artifactId>
+                </exclusion>
             </exclusions>
         </dependency>
 
@@ -130,6 +134,10 @@
                     <groupId>org.apache.arrow</groupId>
                     <artifactId>arrow-vector</artifactId>
                 </exclusion>
+                <exclusion>
+                    <groupId>org.apache.logging.log4j</groupId>
+                    <artifactId>log4j-slf4j-impl</artifactId>
+                </exclusion>
             </exclusions>
         </dependency>
 
diff --git a/amoro-format-mixed/amoro-mixed-trino/pom.xml 
b/amoro-format-mixed/amoro-mixed-trino/pom.xml
index a91f845fe..ff74ad170 100644
--- a/amoro-format-mixed/amoro-mixed-trino/pom.xml
+++ b/amoro-format-mixed/amoro-mixed-trino/pom.xml
@@ -81,6 +81,10 @@
                     <groupId>org.eclipse.jetty.orbit</groupId>
                     <artifactId>javax.servlet</artifactId>
                 </exclusion>
+                <exclusion>
+                    <groupId>org.apache.logging.log4j</groupId>
+                    <artifactId>log4j-to-slf4j</artifactId>
+                </exclusion>
             </exclusions>
         </dependency>
 
@@ -98,6 +102,16 @@
             <groupId>io.airlift</groupId>
             <artifactId>bootstrap</artifactId>
             <version>${airlift.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>*</groupId>
+                    <artifactId>log4j-to-slf4j</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-jdk14</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
 
         <dependency>
diff --git a/amoro-format-paimon/pom.xml b/amoro-format-paimon/pom.xml
index ff98e9559..c28776649 100644
--- a/amoro-format-paimon/pom.xml
+++ b/amoro-format-paimon/pom.xml
@@ -46,6 +46,12 @@
         <dependency>
             <groupId>org.apache.paimon</groupId>
             <artifactId>paimon-bundle</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.apache.logging.log4j</groupId>
+                    <artifactId>log4j-to-slf4j</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
 
         <dependency>
@@ -74,6 +80,10 @@
                     <groupId>org.apache.logging.log4j</groupId>
                     <artifactId>log4j-slf4j2-impl</artifactId>
                 </exclusion>
+                <exclusion>
+                    <groupId>org.apache.logging.log4j</groupId>
+                    <artifactId>log4j-slf4j-impl</artifactId>
+                </exclusion>
             </exclusions>
         </dependency>
     </dependencies>
diff --git a/amoro-optimizer/amoro-optimizer-spark/pom.xml 
b/amoro-optimizer/amoro-optimizer-spark/pom.xml
index 69c4c1ebe..6bcfc94e1 100644
--- a/amoro-optimizer/amoro-optimizer-spark/pom.xml
+++ b/amoro-optimizer/amoro-optimizer-spark/pom.xml
@@ -48,6 +48,10 @@
                     <groupId>org.slf4j</groupId>
                     <artifactId>slf4j-api</artifactId>
                 </exclusion>
+                <exclusion>
+                    <groupId>org.apache.logging.log4j</groupId>
+                    <artifactId>log4j-slf4j-impl</artifactId>
+                </exclusion>
             </exclusions>
         </dependency>
 
@@ -97,6 +101,10 @@
                     <groupId>org.apache.orc</groupId>
                     <artifactId>orc-mapreduce</artifactId>
                 </exclusion>
+                <exclusion>
+                    <groupId>org.apache.logging.log4j</groupId>
+                    <artifactId>log4j-slf4j-impl</artifactId>
+                </exclusion>
             </exclusions>
         </dependency>
     </dependencies>
diff --git a/amoro-optimizer/amoro-optimizer-standalone/pom.xml 
b/amoro-optimizer/amoro-optimizer-standalone/pom.xml
index 57b82bff2..73cad3d6a 100644
--- a/amoro-optimizer/amoro-optimizer-standalone/pom.xml
+++ b/amoro-optimizer/amoro-optimizer-standalone/pom.xml
@@ -49,7 +49,7 @@
 
         <dependency>
             <groupId>org.apache.logging.log4j</groupId>
-            <artifactId>log4j-slf4j-impl</artifactId>
+            <artifactId>log4j-slf4j2-impl</artifactId>
             <scope>runtime</scope>
         </dependency>
 
diff --git a/dev/deps/dependencies-hadoop-2-spark-3.3 
b/dev/deps/dependencies-hadoop-2-spark-3.3
index 59c955b2b..9c38f9fd8 100644
--- a/dev/deps/dependencies-hadoop-2-spark-3.3
+++ b/dev/deps/dependencies-hadoop-2-spark-3.3
@@ -292,7 +292,7 @@ 
listenablefuture/9999.0-empty-to-avoid-conflict-with-guava//listenablefuture-999
 log4j-1.2-api/2.20.0//log4j-1.2-api-2.20.0.jar
 log4j-api/2.20.0//log4j-api-2.20.0.jar
 log4j-core/2.20.0//log4j-core-2.20.0.jar
-log4j-slf4j-impl/2.20.0//log4j-slf4j-impl-2.20.0.jar
+log4j-slf4j2-impl/2.20.0//log4j-slf4j2-impl-2.20.0.jar
 lucene-core/8.11.2//lucene-core-8.11.2.jar
 lz4-java/1.8.0//lz4-java-1.8.0.jar
 metrics-core/4.2.19//metrics-core-4.2.19.jar
diff --git a/dev/deps/dependencies-hadoop-3-spark-3.5 
b/dev/deps/dependencies-hadoop-3-spark-3.5
index d99a4078a..5a1400e08 100644
--- a/dev/deps/dependencies-hadoop-3-spark-3.5
+++ b/dev/deps/dependencies-hadoop-3-spark-3.5
@@ -264,7 +264,7 @@ 
listenablefuture/9999.0-empty-to-avoid-conflict-with-guava//listenablefuture-999
 log4j-1.2-api/2.20.0//log4j-1.2-api-2.20.0.jar
 log4j-api/2.20.0//log4j-api-2.20.0.jar
 log4j-core/2.20.0//log4j-core-2.20.0.jar
-log4j-slf4j-impl/2.20.0//log4j-slf4j-impl-2.20.0.jar
+log4j-slf4j2-impl/2.20.0//log4j-slf4j2-impl-2.20.0.jar
 lucene-core/8.11.2//lucene-core-8.11.2.jar
 lz4-java/1.8.0//lz4-java-1.8.0.jar
 metrics-core/4.2.19//metrics-core-4.2.19.jar
diff --git a/pom.xml b/pom.xml
index 3bd16417a..9ea3287f3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -654,6 +654,13 @@
                 <version>${slf4j.version}</version>
             </dependency>
 
+            <dependency>
+                <groupId>org.apache.logging.log4j</groupId>
+                <artifactId>log4j-slf4j2-impl</artifactId>
+                <version>${log4j.version}</version>
+            </dependency>
+
+            <!-- SLF4J 1.x binding, only needed by modules running Spark 3.3 
(test scope) -->
             <dependency>
                 <groupId>org.apache.logging.log4j</groupId>
                 <artifactId>log4j-slf4j-impl</artifactId>
@@ -1384,7 +1391,7 @@
         <!-- tests will have log4j as the default logging framework available 
-->
         <dependency>
             <groupId>org.apache.logging.log4j</groupId>
-            <artifactId>log4j-slf4j-impl</artifactId>
+            <artifactId>log4j-slf4j2-impl</artifactId>
             <scope>test</scope>
         </dependency>
 
@@ -1800,6 +1807,39 @@
         </pluginManagement>
 
         <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-enforcer-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>ban-conflicting-logging-dependencies</id>
+                        <goals>
+                            <goal>enforce</goal>
+                        </goals>
+                        <phase>verify</phase>
+                        <configuration>
+                            <rules>
+                                <bannedDependencies>
+                                    <excludes>
+                                        <!-- Reverses log4j-slf4j2-impl, 
causing a logging loop -->
+                                        
<exclude>org.apache.logging.log4j:log4j-to-slf4j</exclude>
+                                        <!-- SLF4J 1.x bindings — must not 
coexist with log4j-slf4j2-impl.
+                                             Note: log4j-slf4j-impl is NOT 
banned because Spark 3.3's
+                                             Logging trait hard-references 
org.slf4j.impl.StaticLoggerBinder;
+                                             modules running Spark 3.3 may opt 
in with test scope. -->
+                                        
<exclude>org.slf4j:slf4j-log4j12</exclude>
+                                        
<exclude>org.slf4j:slf4j-simple</exclude>
+                                        <exclude>org.slf4j:slf4j-nop</exclude>
+                                        
<exclude>org.slf4j:slf4j-jdk14</exclude>
+                                    </excludes>
+                                    <message>These logging dependencies 
conflict with log4j-slf4j2-impl. Exclude them at the source.</message>
+                                </bannedDependencies>
+                            </rules>
+                            <fail>true</fail>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-jar-plugin</artifactId>

Reply via email to