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

    https://github.com/apache/spark/pull/1547#discussion_r15631493
  
    --- Diff: core/src/main/scala/org/apache/spark/Logging.scala ---
    @@ -110,23 +107,27 @@ trait Logging {
       }
     
       private def initializeLogging() {
    -    // If Log4j is being used, but is not initialized, load a default 
properties file
    -    val binder = StaticLoggerBinder.getSingleton
    -    val usingLog4j = 
binder.getLoggerFactoryClassStr.endsWith("Log4jLoggerFactory")
    -    val log4jInitialized = 
LogManager.getRootLogger.getAllAppenders.hasMoreElements
    -    if (!log4jInitialized && usingLog4j) {
    +    // Don't use a logger in here, as this is itself occurring during 
initialization of a logger
    +    // If Log4j 1.2 is being used, but is not initialized, load a default 
properties file
    +    val binderClass = 
StaticLoggerBinder.getSingleton.getLoggerFactoryClassStr
    +    // This distinguishes the log4j 1.2 binding, currently
    +    // org.slf4j.impl.Log4jLoggerFactory, from the log4j 2.0 binding, 
currently
    +    // org.apache.logging.slf4j.Log4jLoggerFactory
    +    val usingLog4j12 = 
"org.slf4j.impl.Log4jLoggerFactory".equals(binderClass)
    +    val log4j12Initialized = 
LogManager.getRootLogger.getAllAppenders.hasMoreElements
    +    if (!log4j12Initialized && usingLog4j12) {
           val defaultLogProps = "org/apache/spark/log4j-defaults.properties"
           Option(Utils.getSparkClassLoader.getResource(defaultLogProps)) match 
{
             case Some(url) =>
               PropertyConfigurator.configure(url)
    -          log.info(s"Using Spark's default log4j profile: 
$defaultLogProps")
    +          System.out.println(s"Using Spark's default log4j profile: 
$defaultLogProps")
    --- End diff --
    
    I will change it. `System.err` felt inappropriate for informational 
messages (but not for errors -- if you can't configure the logger, where else 
can you turn? so the following `System.err` makes sense).  Yeah I'm not sure 
`System.err` is a great place to log by default, but people can change it. Here 
you couldn't move this informational message out of `System.err` no matter 
what. That was my thinking but I imagine this is not a big deal.


---
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.
---

Reply via email to