[ 
https://issues.apache.org/jira/browse/SPARK-4147?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14191149#comment-14191149
 ] 

Tobias Pfeiffer commented on SPARK-4147:
----------------------------------------

Just to be clear: I didn't necessarily mean "Spark shouldn't use log4j" 
(although I think so), but I was suggesting that in the code I linked, simply 
pulling the call to {{LogManager.getRootLogger}} _inside_ the {{if 
(usingLog4j12)}} block _might_ allow to run Spark without log4j on the 
classpath. However, I just discovered that a direct access to log4j is actually 
done in other places in the core as well 
([https://github.com/apache/spark/search?utf8=%E2%9C%93&q=%22import+org.apache.log4j%22+path%3Acore&type=Code]),
 so I think it wouldn't suffice to just change two lines.

Therefore, if it is consensus that the hard dependency on log4j is intended 
then this issue can be closed, I think.

> Remove log4j dependency
> -----------------------
>
>                 Key: SPARK-4147
>                 URL: https://issues.apache.org/jira/browse/SPARK-4147
>             Project: Spark
>          Issue Type: Wish
>          Components: Spark Core
>    Affects Versions: 1.1.0
>            Reporter: Tobias Pfeiffer
>
> spark-core has a hard dependency on log4j, which shouldn't be necessary since 
> slf4j is used. I tried to exclude slf4j-log4j12 and log4j dependencies in my 
> sbt file.
> Excluding org.slf4j.slf4j-log4j12 works fine if logback is on the classpath. 
> However, removing the log4j dependency fails because in 
> https://github.com/apache/spark/blob/v1.1.0/core/src/main/scala/org/apache/spark/Logging.scala#L121
>  a static method of org.apache.log4j.LogManager is accessed *even if* log4j 
> is not in use.
> I guess removing all dependencies on log4j may be a bigger task, but it would 
> be a great help if the access to LogManager would be done only if log4j use 
> was detected before. (This is a 2-line change.)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to