Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,9 @@ object SparkSubmit extends CommandLineUtils with Logging {
var localJars: String = null
var localPyFiles: String = null
if (deployMode == CLIENT) {
// This security manager will not need an auth secret, but set a dummy value in case
// spark.authenticate is enabled, otherwise an exception is thrown.
sparkConf.set(SecurityManager.SPARK_AUTH_SECRET_CONF, "unused")
val secMgr = new SecurityManager(sparkConf)
localPrimaryResource = Option(args.primaryResource).map {
downloadFile(_, targetDir, sparkConf, hadoopConf, secMgr)
Expand Down
9 changes: 8 additions & 1 deletion core/src/main/scala/org/apache/spark/internal/Logging.scala
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ trait Logging {
val log4j12Initialized = LogManager.getRootLogger.getAllAppenders.hasMoreElements
// scalastyle:off println
if (!log4j12Initialized) {
Logging.defaultSparkLog4jConfig = true
val defaultLogProps = "org/apache/spark/log4j-defaults.properties"
Option(Utils.getSparkClassLoader.getResource(defaultLogProps)) match {
case Some(url) =>
Expand Down Expand Up @@ -164,6 +165,7 @@ trait Logging {
private[spark] object Logging {
@volatile private var initialized = false
@volatile private var defaultRootLevel: Level = null
@volatile private var defaultSparkLog4jConfig = false

val initLock = new Object()
try {
Expand All @@ -186,7 +188,12 @@ private[spark] object Logging {
*/
def uninitialize(): Unit = initLock.synchronized {
if (isLog4j12()) {
LogManager.resetConfiguration()
if (defaultSparkLog4jConfig) {
defaultSparkLog4jConfig = false
LogManager.resetConfiguration()
} else {
LogManager.getRootLogger().setLevel(defaultRootLevel)
}
}
this.initialized = false
}
Expand Down