apache / apache/beam

Logging from DoFn doesn't work with Spark Runner in cluster mode

Open
#20,757 0 comments 0 reactions 0 assignees View on GitHub
bug P3 runners spark
Dominant language
Java
Stars
8.7k
Forks
4.7k
Avg merge
1d 20h
Merged PRs (30d)
196

Description

Log messages emitted by any DoFn is not logged by spark executors when the pipeline is run with Spark in cluster deployment mode (on YARN). Tested on Cloudera 6 with Spark 2.4.

I made a test project to reproduce the issue: [https://github.com/ventuc/beam-log-test](https://github.com/ventuc/beam-log-test). Run it with:

`spark-submit --class beam.tests.log.LogTesting --name LogTesting --deploy-mode cluster --master yarn --conf "spark.driver.extraJavaOptions=-Dlog4j.configuration=[file:log4j.properties|file://log4j.properties/]" --conf "spark.executor.extraJavaOptions=-Dlog4j.configuration=[file:log4j.properties|file://log4j.properties/]" --files $HOME/log4j.properties beam-log-test-0.0.1-SNAPSHOT.jar`

To retrieve logs from YARN run:

`yarn logs -applicationId `

As you can see, logs from the beam.tests.log appear only in the driver's log, and not in the executor's log.

 

There's not any documentation about how to handle logs in Beam with the Spark runner. Please document it as requested also by BEAM-792.

 

Imported from Jira [BEAM-11735](https://issues.apache.org/jira/browse/BEAM-11735). Original Jira may contain additional context.
Reported by: claventu.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.