Newer Version Available

This content describes an older version of this product. View Latest

Log Messages and Log Levels

Salesforce CLI writes all log messages to the USER_HOME_DIR/.sfdx/sfdx.log file. CLI invocations append log messages to this running log file. Only errors are output to the terminal or command window from which you run the CLI.

The files in the USER_HOME_DIR/.sfdx directory are used internally by Salesforce CLI. Do not remove or edit them.

Important

The default level of log messages is warn. You can set the log level to one of the following, listed in order of least to most information. The level is cumulative: for the debug level. The --loglevel parameter supports parameter values in only lowercase (due to the migration to oclif). To assist you with the transition, we support uppercase parameters in Spring ’19 but plan to deprecate support for them in Summer ’19.

  • error
  • warn
  • info
  • debug
  • trace
  • fatal

You can change the log level in two ways, depending on what you want to accomplish.

To change the log level for the execution of a single CLI command, use the --loglevel parameter. Changing the log level in this way does not affect subsequent CLI use. This example specifies debug-level log messages when you create a scratch org.

1sfdx force:org:create --definitionfile config/project-scratch-def.json --loglevel debug --setalias my-scratch-org

To globally set the log level for all CLI commands, set the SFDX_LOG_LEVEL environment variable. For example, on UNIX:

1export SFDX_LOG_LEVEL=debug

Salesforce CLI gathers diagnostic information about its use and reports it to Salesforce so that the development team can investigate issues. The type of information includes command duration and command invocation counts.

Note