5

Can anyone help me with the spark configuration needed to set logging level to debug and capture more logs

1

1 Answer 1

8

Set setLogLevel property to DEBUG in sparksession.

from pyspark.sql import SparkSession
spark = SparkSession.builder.master('local').appName('test').getOrCreate()
spark.sparkContext.setLogLevel("DEBUG")

#or

log4j = sc._jvm.org.apache.log4j
log4j.LogManager.getRootLogger().setLevel(log4j.Level.DEBUG)

#for custom log
log4j.LogManager.getRootLogger().info("custom log")
#2020-05-06 13:43:42 INFO  root:? - custom log
Sign up to request clarification or add additional context in comments.

3 Comments

Thanks. But i think this line is creating end less console output in my case. The error was around "connection error"
@user13485171, Could you update the question with steps you are performing and error?
I would like to but i can't as that's little confidential My code looks like Setting environment variables Creating spark session similarly Then i tried to change log level So with the new code recreted the issue I think it's more because of my server settings/permission I'll take this up with my IT and update you why it happened

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.