Skip to content

Commit e74450b

Browse files
committed
SPARK-1252. On YARN, use container-log4j.properties for executors
1 parent b5bae84 commit e74450b

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

yarn/common/src/main/scala/org/apache/spark/deploy/yarn/ClientBase.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,8 @@ trait ClientBase extends Logging {
344344
JAVA_OPTS += " " + env("SPARK_JAVA_OPTS")
345345
}
346346

347+
JAVA_OPTS += " " + YarnSparkHadoopUtil.getLoggingArgsForContainerCommandLine()
348+
347349
// Command for the ApplicationMaster
348350
val commands = List[String](
349351
Environment.JAVA_HOME.$() + "/bin/java" +

yarn/common/src/main/scala/org/apache/spark/deploy/yarn/ExecutorRunnableUtil.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ trait ExecutorRunnableUtil extends Logging {
6262

6363
JAVA_OPTS += " -Djava.io.tmpdir=" +
6464
new Path(Environment.PWD.$(), YarnConfiguration.DEFAULT_CONTAINER_TEMP_DIR) + " "
65+
JAVA_OPTS += YarnSparkHadoopUtil.getLoggingArgsForContainerCommandLine() + " "
6566

6667
// Commenting it out for now - so that people can refer to the properties if required. Remove
6768
// it once cpuset version is pushed out.

yarn/common/src/main/scala/org/apache/spark/deploy/yarn/YarnSparkHadoopUtil.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import org.apache.hadoop.mapred.JobConf
2222
import org.apache.hadoop.security.Credentials
2323
import org.apache.hadoop.security.UserGroupInformation
2424
import org.apache.hadoop.yarn.conf.YarnConfiguration
25+
import org.apache.hadoop.yarn.api.ApplicationConstants
2526
import org.apache.hadoop.conf.Configuration
2627
import org.apache.spark.deploy.SparkHadoopUtil
2728

@@ -67,3 +68,16 @@ class YarnSparkHadoopUtil extends SparkHadoopUtil {
6768
}
6869

6970
}
71+
72+
object YarnSparkHadoopUtil {
73+
def getLoggingArgsForContainerCommandLine(): String = {
74+
"-Dlog4j.configuration=container-log4j.properties " +
75+
"-Dhadoop.root.logger=INFO,CLA " +
76+
// for yarn/stable:
77+
"-Dyarn.app.container.log.filesize=0 " +
78+
"-Dyarn.app.container.log.dir=" + ApplicationConstants.LOG_DIR_EXPANSION_VAR + " " +
79+
// for yarn/alpha:
80+
"-Dyarn.app.mapreduce.container.log.dir=" + ApplicationConstants.LOG_DIR_EXPANSION_VAR + " " +
81+
"-Dyarn.app.mapreduce.container.log.filesize=0"
82+
}
83+
}

0 commit comments

Comments
 (0)