cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

How do I change the log level in Databricks?

brickster_2018
Esteemed Contributor

How can I change the log level of the Spark Driver and executor process?

1 ACCEPTED SOLUTION

Accepted Solutions

brickster_2018
Esteemed Contributor

Change the log level of Driver:

%scala 
 
spark.sparkContext.setLogLevel("DEBUG")
 
spark.sparkContext.setLogLevel("INFO")

Change the log level of a particular package in Driver logs:

%scala
 
org.apache.log4j.Logger.getLogger("shaded.databricks.v20180920_b33d810.org.apache.hadoop.fs.azurebfs.services").setLevel(org.apache.log4j.Level.TRACE)

Change the log level in the executor

sc.parallelize(Seq("")).foreachPartition(x => {
  import org.apache.log4j.{LogManager, Level}
  import org.apache.commons.logging.LogFactory
 
  LogManager.getRootLogger().setLevel(Level.DEBUG)
  val log = LogFactory.getLog("EXECUTOR-LOG:")
  log.debug("START EXECUTOR DEBUG LOG LEVEL")
})

https://kb.databricks.com/clusters/set-executor-log-level.html

View solution in original post

1 REPLY 1

brickster_2018
Esteemed Contributor

Change the log level of Driver:

%scala 
 
spark.sparkContext.setLogLevel("DEBUG")
 
spark.sparkContext.setLogLevel("INFO")

Change the log level of a particular package in Driver logs:

%scala
 
org.apache.log4j.Logger.getLogger("shaded.databricks.v20180920_b33d810.org.apache.hadoop.fs.azurebfs.services").setLevel(org.apache.log4j.Level.TRACE)

Change the log level in the executor

sc.parallelize(Seq("")).foreachPartition(x => {
  import org.apache.log4j.{LogManager, Level}
  import org.apache.commons.logging.LogFactory
 
  LogManager.getRootLogger().setLevel(Level.DEBUG)
  val log = LogFactory.getLog("EXECUTOR-LOG:")
  log.debug("START EXECUTOR DEBUG LOG LEVEL")
})

https://kb.databricks.com/clusters/set-executor-log-level.html

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group