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

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


The following commit(s) were added to refs/heads/master by this push:
     new 518888359b3 [SPARK-43888][CORE] Relocate Logging to common/utils
518888359b3 is described below

commit 518888359b3e57de8421b1929045de9ff48890b8
Author: Rui Wang <[email protected]>
AuthorDate: Wed May 31 10:02:14 2023 -0700

    [SPARK-43888][CORE] Relocate Logging to common/utils
    
    ### What changes were proposed in this pull request?
    
    We can relocate logging to common/utils so share it among Spark Connect 
client and Spark core.
    
    ### Why are the changes needed?
    
    ### Does this PR introduce _any_ user-facing change?
    
    Towards the goal that Spark Connect client do not need to depend on Spark 
core.
    
    ### How was this patch tested?
    
    Existing UT
    
    Closes #41391 from amaliujia/refactor_logging.
    
    Authored-by: Rui Wang <[email protected]>
    Signed-off-by: Dongjoon Hyun <[email protected]>
---
 common/utils/pom.xml                               | 29 ++++++++++++++++++++++
 .../scala/org/apache/spark/internal/Logging.scala  |  6 ++---
 core/pom.xml                                       | 29 ----------------------
 3 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/common/utils/pom.xml b/common/utils/pom.xml
index 53df20b646d..ee10a606182 100644
--- a/common/utils/pom.xml
+++ b/common/utils/pom.xml
@@ -51,6 +51,35 @@
       <groupId>org.apache.commons</groupId>
       <artifactId>commons-text</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>jul-to-slf4j</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>jcl-over-slf4j</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-slf4j2-impl</artifactId>
+    </dependency>
+    <dependency>
+      <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-1.2-api</artifactId>
+    </dependency>
   </dependencies>
   <build>
     
<outputDirectory>target/scala-${scala.binary.version}/classes</outputDirectory>
diff --git a/core/src/main/scala/org/apache/spark/internal/Logging.scala 
b/common/utils/src/main/scala/org/apache/spark/internal/Logging.scala
similarity index 98%
rename from core/src/main/scala/org/apache/spark/internal/Logging.scala
rename to common/utils/src/main/scala/org/apache/spark/internal/Logging.scala
index b6e3914622a..83e01330ce3 100644
--- a/core/src/main/scala/org/apache/spark/internal/Logging.scala
+++ b/common/utils/src/main/scala/org/apache/spark/internal/Logging.scala
@@ -27,7 +27,7 @@ import org.apache.logging.log4j.core.filter.AbstractFilter
 import org.slf4j.{Logger, LoggerFactory}
 
 import org.apache.spark.internal.Logging.SparkShellLoggingFilter
-import org.apache.spark.util.Utils
+import org.apache.spark.util.SparkClassUtils
 
 /**
  * Utility trait for classes that want to log data. Creates a SLF4J logger for 
the class and allows
@@ -133,7 +133,7 @@ trait Logging {
       if (Logging.islog4j2DefaultConfigured()) {
         Logging.defaultSparkLog4jConfig = true
         val defaultLogProps = "org/apache/spark/log4j2-defaults.properties"
-        Option(Utils.getSparkClassLoader.getResource(defaultLogProps)) match {
+        
Option(SparkClassUtils.getSparkClassLoader.getResource(defaultLogProps)) match {
           case Some(url) =>
             val context = 
LogManager.getContext(false).asInstanceOf[LoggerContext]
             context.setConfigLocation(url.toURI)
@@ -197,7 +197,7 @@ private[spark] object Logging {
   try {
     // We use reflection here to handle the case where users remove the
     // slf4j-to-jul bridge order to route their logs to JUL.
-    val bridgeClass = Utils.classForName("org.slf4j.bridge.SLF4JBridgeHandler")
+    val bridgeClass = 
SparkClassUtils.classForName("org.slf4j.bridge.SLF4JBridgeHandler")
     bridgeClass.getMethod("removeHandlersForRootLogger").invoke(null)
     val installed = 
bridgeClass.getMethod("isInstalled").invoke(null).asInstanceOf[Boolean]
     if (!installed) {
diff --git a/core/pom.xml b/core/pom.xml
index 4413ba6b634..79bf8a21635 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -218,35 +218,6 @@
       <groupId>com.google.code.findbugs</groupId>
       <artifactId>jsr305</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>jul-to-slf4j</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>jcl-over-slf4j</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.logging.log4j</groupId>
-      <artifactId>log4j-slf4j2-impl</artifactId>
-    </dependency>
-    <dependency>
-      <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-1.2-api</artifactId>
-    </dependency>
 
     <dependency>
       <groupId>com.ning</groupId>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to