Troubleshoot the Databricks CLI

Note

This information applies to Databricks CLI versions 0.205 and above, which are in Public Preview. To find your version of the Databricks CLI, run databricks -v.

Use the following information to troubleshoot issues with the Databricks CLI.

Enable logging

If a command fails or does not produce the expected output, you can use logging to help identify what might have gone wrong. You can log messages that the Databricks CLI outputs about various command events, warnings, and errors. To log these messages, specify the following Databricks CLI command options:

Flag

Description

--log-file

A string representing the file to write output logs to. If this flag is not specified then the default is to write output logs to stderr.

--log-format

text to write output logs to text or json to write output logs to JSON. If this flag is not specified then output logs are written as text.

--log-level

A string representing the log format level. If not specified then the log format level is disabled.

For --log-level, specify one of the following levels:

  • error to log messages at the error level only.

  • warn to log messages at the warn and error levels.

  • info to log messages at the info, error, and warn levels.

  • debug to log messages at the debug, info, error, and warn levels. (--debug is equivalent to --log-level debug.)

  • trace to log messages at the trace, debug, info, error, and warn levels.

  • disabled to not log messages. This is the default if --log-level is not specified.

The following example command logs error messages for only the specified command to a text file named databricks-cli.log. --log-format text is optional because messages are logged in text format by default.

databricks clusters list --log-file databricks-cli.log --log-format text --log-level error

The following example command logs trace, debug, info, error, and warn messages for the specified command to a file named databricks-cli.log in JSON format.

databricks clusters list --log-file databricks-cli.log --log-format json --log-level trace

The following example command logs debug, info, error, and warn messages for the specified command to a file named databricks-cli.log in text format. Because --log-format is not specified, messages are logged in text format.

databricks clusters list --log-file databricks-cli.log --log-level debug

The following example command logs info, error, and warn messages for the specified command to stderr. Because --log-format is not specified, messages are logged in text format.

databricks clusters list --log-level info