b2c-logs
B2C Logs Skill
Use the b2c CLI to retrieve and monitor log files on Salesforce B2C Commerce instances. The logs get command is designed for agent-friendly, non-interactive log retrieval with structured JSON output.
Tip: If
b2cis not installed globally, usenpx @salesforce/b2c-cliinstead (e.g.,npx @salesforce/b2c-cli logs get).
Agent-Friendly Log Retrieval
The logs get command is optimized for coding agents:
- Exits immediately after retrieving logs (non-interactive)
- Supports
--jsonfor structured output - Filters by time, level, and text search
- Auto-normalizes file paths for IDE click-to-open
Examples
Get Recent Logs
# Get last 20 entries from error and customerror logs (default)
b2c logs get
# Get last 50 entries
b2c logs get --count 50
# JSON output for programmatic parsing
b2c logs get --json
Filter by Time
# Entries from the last 5 minutes
b2c logs get --since 5m
# Entries from the last 1 hour
b2c logs get --since 1h
# Entries from the last 2 days
b2c logs get --since 2d
# Entries after a specific time (ISO 8601)
b2c logs get --since "2026-01-25T10:00:00"
Filter by Log Level
# Only ERROR level entries
b2c logs get --level ERROR
# ERROR and FATAL entries
b2c logs get --level ERROR --level FATAL
Search Text
# Search for "OrderMgr" in messages
b2c logs get --search OrderMgr
# Search for payment errors
b2c logs get --search "PaymentProcessor"
Combined Filters
# Recent errors containing "PaymentProcessor"
b2c logs get --since 1h --level ERROR --search "PaymentProcessor" --json
# Last hour of errors and fatals from specific log types
b2c logs get --filter error --filter warn --since 1h --level ERROR --level FATAL
List Available Log Files
# List all log files
b2c logs list
# List specific log types
b2c logs list --filter error --filter customerror
# JSON output
b2c logs list --json
Real-Time Tailing (Human Use)
For interactive log monitoring (not for agents):
# Tail error and customerror logs
b2c logs tail
# Tail specific log types
b2c logs tail --filter debug --filter error
# Tail only ERROR and FATAL level entries
b2c logs tail --level ERROR --level FATAL
# Tail with text search
b2c logs tail --search "PaymentProcessor"
# Combined filtering
b2c logs tail --filter customerror --level ERROR --search "OrderMgr"
# Stop with Ctrl+C
Downloading Full Log Files
To download the complete log file, use the file field from the JSON output with b2c-cli:b2c-webdav:
b2c webdav get error-odspod-0-appserver-20260126.log --root=logs -o -
JSON Output Structure
When using --json, logs get returns:
{
"count": 1,
"entries": [
{
"file": "error-odspod-0-appserver-20260126.log",
"timestamp": "2026-01-26 04:38:03.022 GMT",
"level": "ERROR",
"message": "PipelineCallServlet|156679877|Sites-Site|...",
"raw": "[2026-01-26 04:38:03.022 GMT] ERROR PipelineCallServlet|..."
}
]
}
| Field | Description |
|---|---|
file |
Source log file name (use with b2c-cli:b2c-webdav to download full file) |
level |
Log level: ERROR, WARN, INFO, DEBUG, FATAL, TRACE |
timestamp |
Entry timestamp |
message |
Log message (paths normalized for IDE click-to-open) |
raw |
Raw unprocessed log line |
Log Types
Common log file prefixes:
| Prefix | Description |
|---|---|
error |
System errors |
customerror |
Custom script errors (Logger.error()) |
warn |
Warnings |
debug |
Debug output (when enabled) |
info |
Informational messages |
jobs |
Job execution logs |
api |
API problems and violations |
deprecation |
Deprecated API usage |
quota |
Quota warnings |
More Commands
See b2c logs --help for all available commands and options.
Related Skills
b2c-cli:b2c-webdav- Direct WebDAV file access for downloading full log filesb2c-cli:b2c-config- Verify configuration and credentials
More from salesforcecommercecloud/b2c-developer-tooling
b2c-docs
Search and read B2C Commerce Script API documentation and XSD schemas using the b2c CLI. Use this skill whenever the user needs to look up class methods, understand API signatures, find available properties on commerce objects (baskets, orders, products, customers), or check XML schema formats for imports. Also use when writing server-side scripts and needing API reference — even if they just say "what methods does Basket have" or "what fields can I import for products".
116b2c-webdav
List, upload, download, and manage files on B2C Commerce instances via WebDAV. Use this skill whenever the user needs to upload files to IMPEX directories, download exports from an instance, list remote files, create or delete directories, or zip/unzip files on the server. Also use when managing file transfers to sandboxes or browsing instance file systems -- even if they just say 'upload a file to the instance' or 'check what's in the IMPEX folder'.
103b2c-slas-auth-patterns
Implement SLAS authentication patterns in B2C Commerce including passwordless login (email OTP, SMS OTP, passkeys), session bridging between PWA Kit/Storefront Next and SFRA, hybrid authentication (B2C 25.3+), token refresh flows, trusted system on behalf of (TSOB), and JWT validation. Use this skill whenever the user asks about shopper authentication beyond basic login, token exchange flows, passwordless or biometric auth, keeping sessions alive across storefronts, handling 409 Conflict errors on token endpoints, refreshing shopper tokens, or validating JWTs — even if they don't mention SLAS by name.
90b2c-config
Inspect and debug CLI configuration, instance connections, and authentication. Use this skill whenever the user needs to check which dw.json or credentials are active, manage multiple instance profiles, retrieve OAuth tokens for scripting, troubleshoot authentication failures or connection errors, or integrate with VS Code or other editors. Also use when environment variables override config or the wrong sandbox is being targeted -- even if they just say 'why is it connecting to the wrong instance' or 'get me an access token'.
90b2c-controllers
Create storefront controllers using SFRA or classic patterns with server.get/post, middleware chains, and res.render/json. Use this skill whenever the user needs to build a page route, handle form submissions, create AJAX endpoints, extend or override existing controllers, or add middleware to a request pipeline. Also use when debugging route registration or response rendering -- even if they just say 'new page endpoint' or 'handle a POST request'.
86b2c-scapi-schemas
Browse and retrieve SCAPI OpenAPI schema specifications. Use this skill whenever the user needs to list available SCAPI APIs, inspect endpoint paths or request/response shapes, explore data models for products or orders, check which fields an API returns, or understand SCAPI versioning. Also use when looking up API details before building an integration -- even if they just say 'what fields does the product API return' or 'show me the SCAPI endpoints'.
84