Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Logging Spark:Spark提交赢得';t接受定制log4j.properties_Logging_Apache Spark_Log4j - Fatal编程技术网

Logging Spark:Spark提交赢得';t接受定制log4j.properties

Logging Spark:Spark提交赢得';t接受定制log4j.properties,logging,apache-spark,log4j,Logging,Apache Spark,Log4j,这可能是的重复,但这与Spark1.3/4有关。我正在使用1.5.2 我正在把log4j.properties打包到我的胖罐子里。它在两种情况下表现出不同的行为。在ubuntumachine1上,我的用户目录中有spark。在类似的机器2上,我安装了it系统。在机器2上,默认的log4j.properties位于:/etc/spark/conf/log4j.properties 在machine2上,fat jar中打包的log4j.properties未加载,但在machine1上加载。我在两

这可能是的重复,但这与
Spark
1.3/4
有关。我正在使用
1.5.2

我正在把
log4j.properties
打包到我的胖罐子里。它在两种情况下表现出不同的行为。在ubuntu
machine1
上,我的用户目录中有spark。在类似的
机器2
上,我安装了it系统。在机器2上,默认的
log4j.properties
位于:
/etc/spark/conf/log4j.properties

machine2
上,fat jar中打包的
log4j.properties
未加载,但在
machine1
上加载。我在两台机器上使用相同的命令:

spark-submit 
--master local[1]   
--class com.myCompany.myMainClass  myFat.jar
基于此,我可以通过以下方式从外部提供信息,从而有力地做到这一点:

spark-submit 
--master local[1]
--driver-java-options "-Dlog4j.configuration=file:///mnt1/mohit/log4j.properties"
--class com.myCompany.myMainClass 
myFat.jar 

为什么行为不同?如何使spark提交以使用打包文件?

您所指的文档适用于纱线,但您是在本地模式下运行的

尝试按如下方式指定它:

spark-submit 
--master local[1]
--conf "spark.executor.extraJavaOptions=-Dlog4j.configuration=/mnt1/mohit/log4j.properties"
--class com.myCompany.myMainClass 
myFat.jar 

感谢您的更正,但问题仍然存在。为什么不能使用打包的log4j属性?有关打包的log4j属性,请参阅此问题: