Logging
The CLI uses pino for structured logging with pretty-printed output by default.
Output Modes
Pretty Print (Default)
Human-readable output with colors, suitable for interactive terminal use:
[18:31:58] INFO: Deploying cartridges...
[18:31:59] INFO: Upload completeJSON Lines (--json)
Machine-readable output for scripting, CI/CD pipelines, and log aggregation:
b2c code deploy --json{"level":"info","time":1764113529411,"command":"code deploy","msg":"Deploying cartridges..."}
{"level":"info","time":1764113529412,"command":"code deploy","msg":"Upload complete"}Log Levels
Control verbosity with --log-level or -D for debug:
| Level | Description |
|---|---|
trace | Maximum verbosity |
debug | Detailed operational info |
info | Normal messages (default) |
warn | Warnings |
error | Errors only |
silent | No output |
b2c code deploy --log-level debug
b2c code deploy -D # shorthand for --log-level debugIn debug/trace mode, context objects are displayed:
[18:31:58] INFO: Upload complete
command: "code deploy"
file: "cartridge.zip"
bytes: 45678
duration: 1234Flags
| Flag | Environment Variable | Description |
|---|---|---|
--log-level | SFCC_LOG_LEVEL | Set log verbosity |
-D, --debug | SFCC_DEBUG | Enable debug logging |
--json | Output JSON lines |
Environment Variables
| Variable | Description |
|---|---|
SFCC_LOG_LEVEL | Log level (trace, debug, info, warn, error, silent) |
SFCC_DEBUG | Enable debug logging |
SFCC_LOG_TO_STDOUT | Send logs to stdout instead of stderr |
SFCC_LOG_COLORIZE | Force colors on/off |
SFCC_REDACT_SECRETS | Set to false to disable secret redaction |
NO_COLOR | Industry standard to disable colors |
DEBUG | Set to oclif* for CLI framework debug logs |
CLI Framework Debugging
For low-level debugging of the CLI parser and command loading, use the oclif debug flag:
DEBUG=oclif* b2c code deployThis outputs internal oclif framework logs, useful for troubleshooting command resolution, plugin loading, and argument parsing issues.
Output Streams
By default, logs go to stderr so that command output (data, IDs, etc.) can be piped cleanly:
# Logs go to stderr, JSON output goes to stdout
b2c sites list --json 2>/dev/null | jq '.sites[0].id'To send logs to stdout instead:
SFCC_LOG_TO_STDOUT=1 b2c code deploySecret Redaction
Sensitive fields are automatically redacted from log output:
password,secret,tokenclient_secret,access_token,refresh_tokenapi_key,authorization
[18:31:58] INFO: Authenticating
client_id: "my-client"
client_secret: "[REDACTED]"To disable redaction (for debugging):
SFCC_REDACT_SECRETS=false b2c code deploy --debugCI/CD Usage
For CI/CD pipelines, use JSON output and disable colors:
NO_COLOR=1 b2c code deploy --json 2>&1 | tee deploy.logOr explicitly set the log level:
SFCC_LOG_LEVEL=info b2c code deploy --json