问题描述
我猜这是一个愚蠢的问题,但是我在任何地方都找不到答案.
I guesss its a silly question, but I couldnt find answer anywhere.
我可以配置使用log4j.xml登录spark吗?
Can I configure logging in spark using log4j.xml?
在Spark 文档中,提到可以配置日志记录对于log4j.properties,我希望将log4j.xml用于更高级的log4j功能,例如异步附加程序.我的工作将在通过oozie安排的纱线(CDH)上以群集模式运行.我知道在任何解决方案中都急需使用-files
In spark documentation its mentioned you can configure logging with log4j.properties, I wish to use log4j.xml for more advance log4j capabilities such as async appender. my job will run in cluster mode over yarn (CDH) scheduled with oozie. Im aware ill need in any solution to use --files
推荐答案
您可以设置 spark.executor.extraJavaOptions
来添加 -Dlog4j.configuration = log4j.xml
并将您的log4j.xml文件包含在worker的类路径上(捆绑在应用程序jar中或添加到-files
包含的文件中).
You can set the spark.executor.extraJavaOptions
to add -Dlog4j.configuration=log4j.xml
and include your log4j.xml file on the classpath of the workers (either bundling in the application jar or adding to the files included with --files
).
这篇关于使用log4j.xml配置Spark日志记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!