mridulm commented on a change in pull request #34079:
URL: https://github.com/apache/spark/pull/34079#discussion_r721724785



##########
File path: 
common/network-yarn/src/main/java/org/apache/spark/network/yarn/YarnShuffleService.java
##########
@@ -199,11 +206,24 @@ protected void serviceInit(Configuration externalConf) 
throws Exception {
     _conf = new Configuration(externalConf);
     URL confOverlayUrl = Thread.currentThread().getContextClassLoader()
         .getResource(SHUFFLE_SERVICE_CONF_OVERLAY_RESOURCE_NAME);
+    String className = YarnShuffleService.class.getName();
     if (confOverlayUrl != null) {
-      logger.info("Initializing Spark YARN shuffle service with configuration 
overlay from {}",
-          confOverlayUrl);
       _conf.addResource(confOverlayUrl);
     }
+    String logsNamespace = _conf.get(SPARK_SHUFFLE_SERVICE_LOGS_NAMESPACE_KEY, 
"");
+    String loggerName = logsNamespace.isEmpty() ? className : className + "." 
+ logsNamespace;
+    logger = LoggerFactory.getLogger(loggerName);

Review comment:
       Initialize `logger` to `staticLogger` and only create a custom logger in 
case `logsNamespace != ""` ?
   
   ```suggestion
       String logsNamespace = 
_conf.get(SPARK_SHUFFLE_SERVICE_LOGS_NAMESPACE_KEY, "");
       if (!logsNamespace.isEmpty()) {
         String loggerName = className + "." + logsNamespace;
         logger = LoggerFactory.getLogger(loggerName);
       }
   ```
   

##########
File path: 
common/network-yarn/src/main/java/org/apache/spark/network/yarn/YarnShuffleService.java
##########
@@ -199,11 +206,24 @@ protected void serviceInit(Configuration externalConf) 
throws Exception {
     _conf = new Configuration(externalConf);
     URL confOverlayUrl = Thread.currentThread().getContextClassLoader()
         .getResource(SHUFFLE_SERVICE_CONF_OVERLAY_RESOURCE_NAME);
+    String className = YarnShuffleService.class.getName();
     if (confOverlayUrl != null) {
-      logger.info("Initializing Spark YARN shuffle service with configuration 
overlay from {}",
-          confOverlayUrl);

Review comment:
       Add this back

##########
File path: 
common/network-yarn/src/main/java/org/apache/spark/network/yarn/YarnShuffleService.java
##########
@@ -93,7 +93,8 @@
  * This {@code classpath} configuration is only supported on YARN versions >= 
2.9.0.
  */
 public class YarnShuffleService extends AuxiliaryService {
-  private static final Logger logger = 
LoggerFactory.getLogger(YarnShuffleService.class);
+  private static final Logger staticLogger = 
LoggerFactory.getLogger(YarnShuffleService.class);
+  private Logger logger = null;

Review comment:
       ```suggestion
     private Logger logger = staticLogger;
   ```
   
   And use logger for all non-static methods.
   (See comment below in `serviceInit`).

##########
File path: 
common/network-yarn/src/main/java/org/apache/spark/network/yarn/YarnShuffleService.java
##########
@@ -178,7 +185,7 @@ public YarnShuffleService() {
     // because at this point in instantiation there is no Configuration 
object; it is not passed
     // until `serviceInit` is called, at which point it's too late to adjust 
the name.
     super("spark_shuffle");
-    logger.info("Initializing YARN shuffle service for Spark");
+    staticLogger.info("Initializing YARN shuffle service for Spark");

Review comment:
       We can revert this

##########
File path: 
common/network-yarn/src/main/java/org/apache/spark/network/yarn/YarnShuffleService.java
##########
@@ -199,11 +206,24 @@ protected void serviceInit(Configuration externalConf) 
throws Exception {
     _conf = new Configuration(externalConf);
     URL confOverlayUrl = Thread.currentThread().getContextClassLoader()
         .getResource(SHUFFLE_SERVICE_CONF_OVERLAY_RESOURCE_NAME);
+    String className = YarnShuffleService.class.getName();
     if (confOverlayUrl != null) {
-      logger.info("Initializing Spark YARN shuffle service with configuration 
overlay from {}",
-          confOverlayUrl);
       _conf.addResource(confOverlayUrl);
     }
+    String logsNamespace = _conf.get(SPARK_SHUFFLE_SERVICE_LOGS_NAMESPACE_KEY, 
"");
+    String loggerName = logsNamespace.isEmpty() ? className : className + "." 
+ logsNamespace;
+    logger = LoggerFactory.getLogger(loggerName);
+    if (loggerName.contains(" ")) {
+      logger.warn("Logging namespace contains a space which might " +
+              "not be parseable by some frameworks");
+    }
+    if (confOverlayUrl != null) {
+      logger.info("Initialized Spark YARN shuffle service with configuration 
overlay from {}",
+              confOverlayUrl);
+    } else {
+      logger.info("Initialized Spark YARN shuffle service with base 
configuration");
+    }

Review comment:
       We can remove this, and keep the original code.
   
   ```suggestion
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



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

Reply via email to