Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9118#discussion_r42063646
  
    --- Diff: yarn/src/main/scala/org/apache/spark/deploy/yarn/Client.scala ---
    @@ -340,6 +340,15 @@ private[spark] class Client(
               "for alternatives.")
         }
     
    +    // Uploading $SPARK_CONF_DIR/log4j.properties file to the distributed 
cache to make sure that
    +    // the executors will use the latest configurations instead of the 
default values. This is
    +    // required when user changes log4j.properties directly to set the log 
configurations. If
    +    // configuration file is provided through --files then executors will 
be taking configurations
    +    // from --files instead of $SPARK_CONF_DIR/log4j.properties.
    +    val log4jConfUrl = getClass.getResource("/log4j.properties")
    +    val log4jConf =
    +      oldLog4jConf.orElse(Option(if (log4jConfUrl == null) null else 
log4jConfUrl.toString()))
    --- End diff --
    
    So, a more scala-y way of doing this would be:
    
        val log4jConf = 
oldLog4jConf.orElse(Option(getClass.getResource("/log4j.properties")).map(_.toString))
    
    Also, it might be better to use 
`Utils.getContextOrSparkClassLoader.getResource` instead, so that it picks up 
the user's log4j.properties it they embed it in their app's jar.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to