Reputation: 7000
I would like to customize the Log4J configuration for my application in a standalone Spark cluster. I have a log4j.xml file which is inside my application JAR. What is the correct way to get Spark to use that configuration instead of its own Log4J configuration?
I tried using the --conf options to set the following, but no luck.
spark.executor.extraJavaOptions -> -Dlog4j.configuration=log4j.xml
spark.driver.extraJavaOptions -> -Dlog4j.configuration=log4j.xml
I am using Spark 1.4.1 and there's no log4j.properties file in my /conf.
Upvotes: 5
Views: 4245
Reputation: 2234
Try using driver-java-options
. For example:
spark-submit --class my.class --master spark://myhost:7077 --driver-java-options "-Dlog4j.configuration=file:///opt/apps/conf/my.log4j.properties" my.jar
Upvotes: 3
Reputation: 1379
If you are using SBT as package manager/builder:
There is a log4j.properties.template
in $SPARK_HOME/conf
src/main/resource
.template
suffixWorks for me, and will probably include similar steps for other package managers, e.g. maven.
Upvotes: 6