Newer Version Available
Log Messages and Log Levels
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 doesn’t 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-orgTo globally set the log level for all CLI commands, set the SFDX_LOG_LEVEL environment variable. For example, on UNIX:
1export SFDX_LOG_LEVEL=debugRotating Log Files
Salesforce CLI uses rotating log files. By default, every day at midnight the CLI makes a backup copy of the log file and then clears out its entries to start afresh. We keep backups for the past two days along with the current day’s logs. This behavior ensures that the current log file doesn't get too large.
- SFDX_LOG_ROTATION_PERIOD: How often a new log file is created, such as the default value of one day (1d) or two weeks 2w.
- SFDX_LOG_ROTATION_COUNT: Number of backup files to keep. Default value is 2.
For example, let's say you choose a rotation period of 2 weeks and a count of 2. These values ensure that you have backup logs for the four weeks before the first entry in the current log.