Skip to content

Commit f7fa0fe

Browse files
LuciferYangdongjoon-hyun
authored andcommitted
[SPARK-40511][BUILD][CORE] Upgrade slf4j to 2.0.3
### What changes were proposed in this pull request? This pr aims to upgrade slf4j from 1.7.36 to 2.0.3, the main change as follows: 1. Upgrade slf4j version from 1.7.36 to 2.0.3 2. Use ` log4j-slf4j2-impl` instead of ` log4j-slf4j-impl` refer to https://logging.apache.org/log4j/2.x/log4j-slf4j-impl/index.html 3. Adapt to the implementation of `Logging.isLog4j2()`, slf4j2 uses `SLF4JServiceProvider` instead of `StaticLoggerBinder` ### Why are the changes needed? slf4j 1.7.36 is no longer actively developed, and the current stable and actively developed version of slf4j is 2.0.3. - https://www.slf4j.org/news.html - https://www.slf4j.org/faq.html#changesInVersion200 - https://www.slf4j.org/download.html ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Pass GitHub Actions Closes apache#37844 from LuciferYang/slf4j-200. Lead-authored-by: yangjie01 <[email protected]> Co-authored-by: YangJie <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
1 parent 0dc774e commit f7fa0fe

File tree

10 files changed

+18
-19
lines changed

10 files changed

+18
-19
lines changed

common/kvstore/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
</dependency>
9090
<dependency>
9191
<groupId>org.apache.logging.log4j</groupId>
92-
<artifactId>log4j-slf4j-impl</artifactId>
92+
<artifactId>log4j-slf4j2-impl</artifactId>
9393
<scope>test</scope>
9494
</dependency>
9595
<dependency>

common/network-common/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
</dependency>
149149
<dependency>
150150
<groupId>org.apache.logging.log4j</groupId>
151-
<artifactId>log4j-slf4j-impl</artifactId>
151+
<artifactId>log4j-slf4j2-impl</artifactId>
152152
<scope>test</scope>
153153
</dependency>
154154

common/network-shuffle/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
</dependency>
105105
<dependency>
106106
<groupId>org.apache.logging.log4j</groupId>
107-
<artifactId>log4j-slf4j-impl</artifactId>
107+
<artifactId>log4j-slf4j2-impl</artifactId>
108108
<scope>test</scope>
109109
</dependency>
110110

connector/kinesis-asl-assembly/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
</dependency>
133133
<dependency>
134134
<groupId>org.apache.logging.log4j</groupId>
135-
<artifactId>log4j-slf4j-impl</artifactId>
135+
<artifactId>log4j-slf4j2-impl</artifactId>
136136
<version>${log4j.version}</version>
137137
<scope>provided</scope>
138138
</dependency>

core/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@
224224
</dependency>
225225
<dependency>
226226
<groupId>org.apache.logging.log4j</groupId>
227-
<artifactId>log4j-slf4j-impl</artifactId>
227+
<artifactId>log4j-slf4j2-impl</artifactId>
228228
</dependency>
229229
<dependency>
230230
<groupId>org.apache.logging.log4j</groupId>

core/src/main/scala/org/apache/spark/internal/Logging.scala

+2-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import org.apache.logging.log4j.core.appender.ConsoleAppender
2525
import org.apache.logging.log4j.core.config.DefaultConfiguration
2626
import org.apache.logging.log4j.core.filter.AbstractFilter
2727
import org.slf4j.{Logger, LoggerFactory}
28-
import org.slf4j.impl.StaticLoggerBinder
2928

3029
import org.apache.spark.internal.Logging.SparkShellLoggingFilter
3130
import org.apache.spark.util.Utils
@@ -229,8 +228,8 @@ private[spark] object Logging {
229228
// This distinguishes the log4j 1.2 binding, currently
230229
// org.slf4j.impl.Log4jLoggerFactory, from the log4j 2.0 binding, currently
231230
// org.apache.logging.slf4j.Log4jLoggerFactory
232-
val binderClass = StaticLoggerBinder.getSingleton.getLoggerFactoryClassStr
233-
"org.apache.logging.slf4j.Log4jLoggerFactory".equals(binderClass)
231+
"org.apache.logging.slf4j.Log4jLoggerFactory"
232+
.equals(LoggerFactory.getILoggerFactory.getClass.getName)
234233
}
235234

236235
// Return true if the logger has custom configuration. It depends on:

dev/deps/spark-deps-hadoop-2-hive-2.3

+4-4
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ javax.jdo/3.2.0-m3//javax.jdo-3.2.0-m3.jar
134134
javolution/5.5.1//javolution-5.5.1.jar
135135
jaxb-api/2.2.11//jaxb-api-2.2.11.jar
136136
jaxb-runtime/2.3.2//jaxb-runtime-2.3.2.jar
137-
jcl-over-slf4j/1.7.36//jcl-over-slf4j-1.7.36.jar
137+
jcl-over-slf4j/2.0.3//jcl-over-slf4j-2.0.3.jar
138138
jdo-api/3.0.1//jdo-api-3.0.1.jar
139139
jersey-client/2.36//jersey-client-2.36.jar
140140
jersey-common/2.36//jersey-common-2.36.jar
@@ -158,7 +158,7 @@ json4s-scalap_2.12/3.7.0-M11//json4s-scalap_2.12-3.7.0-M11.jar
158158
jsp-api/2.1//jsp-api-2.1.jar
159159
jsr305/3.0.0//jsr305-3.0.0.jar
160160
jta/1.1//jta-1.1.jar
161-
jul-to-slf4j/1.7.36//jul-to-slf4j-1.7.36.jar
161+
jul-to-slf4j/2.0.3//jul-to-slf4j-2.0.3.jar
162162
kryo-shaded/4.0.2//kryo-shaded-4.0.2.jar
163163
kubernetes-client-api/6.1.1//kubernetes-client-api-6.1.1.jar
164164
kubernetes-client/6.1.1//kubernetes-client-6.1.1.jar
@@ -191,7 +191,7 @@ libthrift/0.12.0//libthrift-0.12.0.jar
191191
log4j-1.2-api/2.19.0//log4j-1.2-api-2.19.0.jar
192192
log4j-api/2.19.0//log4j-api-2.19.0.jar
193193
log4j-core/2.19.0//log4j-core-2.19.0.jar
194-
log4j-slf4j-impl/2.19.0//log4j-slf4j-impl-2.19.0.jar
194+
log4j-slf4j2-impl/2.19.0//log4j-slf4j2-impl-2.19.0.jar
195195
logging-interceptor/3.12.12//logging-interceptor-3.12.12.jar
196196
lz4-java/1.8.0//lz4-java-1.8.0.jar
197197
mesos/1.4.3/shaded-protobuf/mesos-1.4.3-shaded-protobuf.jar
@@ -244,7 +244,7 @@ scala-parser-combinators_2.12/1.1.2//scala-parser-combinators_2.12-1.1.2.jar
244244
scala-reflect/2.12.17//scala-reflect-2.12.17.jar
245245
scala-xml_2.12/2.1.0//scala-xml_2.12-2.1.0.jar
246246
shims/0.9.32//shims-0.9.32.jar
247-
slf4j-api/1.7.36//slf4j-api-1.7.36.jar
247+
slf4j-api/2.0.3//slf4j-api-2.0.3.jar
248248
snakeyaml/1.31//snakeyaml-1.31.jar
249249
snappy-java/1.1.8.4//snappy-java-1.1.8.4.jar
250250
spire-macros_2.12/0.17.0//spire-macros_2.12-0.17.0.jar

dev/deps/spark-deps-hadoop-3-hive-2.3

+4-4
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ javax.jdo/3.2.0-m3//javax.jdo-3.2.0-m3.jar
119119
javolution/5.5.1//javolution-5.5.1.jar
120120
jaxb-api/2.2.11//jaxb-api-2.2.11.jar
121121
jaxb-runtime/2.3.2//jaxb-runtime-2.3.2.jar
122-
jcl-over-slf4j/1.7.36//jcl-over-slf4j-1.7.36.jar
122+
jcl-over-slf4j/2.0.3//jcl-over-slf4j-2.0.3.jar
123123
jdo-api/3.0.1//jdo-api-3.0.1.jar
124124
jdom2/2.0.6//jdom2-2.0.6.jar
125125
jersey-client/2.36//jersey-client-2.36.jar
@@ -142,7 +142,7 @@ json4s-jackson_2.12/3.7.0-M11//json4s-jackson_2.12-3.7.0-M11.jar
142142
json4s-scalap_2.12/3.7.0-M11//json4s-scalap_2.12-3.7.0-M11.jar
143143
jsr305/3.0.0//jsr305-3.0.0.jar
144144
jta/1.1//jta-1.1.jar
145-
jul-to-slf4j/1.7.36//jul-to-slf4j-1.7.36.jar
145+
jul-to-slf4j/2.0.3//jul-to-slf4j-2.0.3.jar
146146
kryo-shaded/4.0.2//kryo-shaded-4.0.2.jar
147147
kubernetes-client-api/6.1.1//kubernetes-client-api-6.1.1.jar
148148
kubernetes-client/6.1.1//kubernetes-client-6.1.1.jar
@@ -175,7 +175,7 @@ libthrift/0.12.0//libthrift-0.12.0.jar
175175
log4j-1.2-api/2.19.0//log4j-1.2-api-2.19.0.jar
176176
log4j-api/2.19.0//log4j-api-2.19.0.jar
177177
log4j-core/2.19.0//log4j-core-2.19.0.jar
178-
log4j-slf4j-impl/2.19.0//log4j-slf4j-impl-2.19.0.jar
178+
log4j-slf4j2-impl/2.19.0//log4j-slf4j2-impl-2.19.0.jar
179179
logging-interceptor/3.12.12//logging-interceptor-3.12.12.jar
180180
lz4-java/1.8.0//lz4-java-1.8.0.jar
181181
mesos/1.4.3/shaded-protobuf/mesos-1.4.3-shaded-protobuf.jar
@@ -231,7 +231,7 @@ scala-parser-combinators_2.12/1.1.2//scala-parser-combinators_2.12-1.1.2.jar
231231
scala-reflect/2.12.17//scala-reflect-2.12.17.jar
232232
scala-xml_2.12/2.1.0//scala-xml_2.12-2.1.0.jar
233233
shims/0.9.32//shims-0.9.32.jar
234-
slf4j-api/1.7.36//slf4j-api-1.7.36.jar
234+
slf4j-api/2.0.3//slf4j-api-2.0.3.jar
235235
snakeyaml/1.31//snakeyaml-1.31.jar
236236
snappy-java/1.1.8.4//snappy-java-1.1.8.4.jar
237237
spire-macros_2.12/0.17.0//spire-macros_2.12-0.17.0.jar

launcher/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
</dependency>
7070
<dependency>
7171
<groupId>org.apache.logging.log4j</groupId>
72-
<artifactId>log4j-slf4j-impl</artifactId>
72+
<artifactId>log4j-slf4j2-impl</artifactId>
7373
<scope>test</scope>
7474
</dependency>
7575

pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
<maven.version>3.8.6</maven.version>
114114
<exec-maven-plugin.version>1.6.0</exec-maven-plugin.version>
115115
<sbt.project.name>spark</sbt.project.name>
116-
<slf4j.version>1.7.36</slf4j.version>
116+
<slf4j.version>2.0.3</slf4j.version>
117117
<log4j.version>2.19.0</log4j.version>
118118
<!-- make sure to update IsolatedClientLoader whenever this version is changed -->
119119
<hadoop.version>3.3.4</hadoop.version>
@@ -756,7 +756,7 @@
756756

757757
<dependency>
758758
<groupId>org.apache.logging.log4j</groupId>
759-
<artifactId>log4j-slf4j-impl</artifactId>
759+
<artifactId>log4j-slf4j2-impl</artifactId>
760760
<version>${log4j.version}</version>
761761
<scope>${hadoop.deps.scope}</scope>
762762
</dependency>

0 commit comments

Comments
 (0)