Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log from workers #172

Open
tom-ph opened this issue Mar 1, 2022 · 0 comments
Open

Log from workers #172

tom-ph opened this issue Mar 1, 2022 · 0 comments

Comments

@tom-ph
Copy link

tom-ph commented Mar 1, 2022

Hello,

I'm trying to send application logs from Databricks to an Azure Log Analytics Workspace.
I configured the Databricks Workspace using the documentation and everything seems great, however when I try to make custom log from a python UDF executed from the workers, the code

from pyspark import SparkContext
sc = SparkContext.getOrCreate()
spark_log4j = sc._jvm.org.apache.log4j
logger = spark_log4j.LogManager.getLogger("myCustomLogger")

fails with the exception

Exception: SparkContext should only be created and accessed on the driver.

It is not clear to me how to get a log4j logger from python scripts executed by workers to create custom logs.
Can you please help me with this?

Thank you

Tommaso

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant