b2c-logs

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

B2C Logs Skill

B2C日志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
b2c
is not installed globally, use
npx @salesforce/b2c-cli
instead (e.g.,
npx @salesforce/b2c-cli logs get
).
使用
b2c
CLI检索和监控Salesforce B2C Commerce实例上的日志文件。
logs get
命令专为编码Agent设计,支持非交互式日志检索并输出结构化JSON。
提示: 如果未全局安装
b2c
,请使用
npx @salesforce/b2c-cli
替代(例如:
npx @salesforce/b2c-cli logs get
)。

Agent-Friendly Log Retrieval

适配编码Agent的日志检索

The
logs get
command is optimized for coding agents:
  • Exits immediately after retrieving logs (non-interactive)
  • Supports
    --json
    for structured output
  • Filters by time, level, and text search
  • Auto-normalizes file paths for IDE click-to-open
logs get
命令针对编码Agent进行了优化:
  • 检索日志后立即退出(非交互式)
  • 支持
    --json
    参数以输出结构化内容
  • 可按时间、级别和文本搜索进行过滤
  • 自动标准化文件路径,支持IDE点击跳转

Examples

示例

Get Recent Logs

获取最新日志

bash
undefined
bash
undefined

Get last 20 entries from error and customerror logs (default)

获取错误日志和自定义错误日志的最后20条记录(默认设置)

b2c logs get
b2c logs get

Get last 50 entries

获取最后50条记录

b2c logs get --count 50
b2c logs get --count 50

JSON output for programmatic parsing

输出JSON格式以便程序化解析

b2c logs get --json
undefined
b2c logs get --json
undefined

Filter by Time

按时间过滤

bash
undefined
bash
undefined

Entries from the last 5 minutes

获取最近5分钟的日志条目

b2c logs get --since 5m
b2c logs get --since 5m

Entries from the last 1 hour

获取最近1小时的日志条目

b2c logs get --since 1h
b2c logs get --since 1h

Entries from the last 2 days

获取最近2天的日志条目

b2c logs get --since 2d
b2c logs get --since 2d

Entries after a specific time (ISO 8601)

获取指定时间之后的日志条目(ISO 8601格式)

b2c logs get --since "2026-01-25T10:00:00"
undefined
b2c logs get --since "2026-01-25T10:00:00"
undefined

Filter by Log Level

按日志级别过滤

bash
undefined
bash
undefined

Only ERROR level entries

仅获取ERROR级别的日志条目

b2c logs get --level ERROR
b2c logs get --level ERROR

ERROR and FATAL entries

获取ERROR和FATAL级别的日志条目

b2c logs get --level ERROR --level FATAL
undefined
b2c logs get --level ERROR --level FATAL
undefined

Search Text

文本搜索

bash
undefined
bash
undefined

Search for "OrderMgr" in messages

在日志消息中搜索"OrderMgr"

b2c logs get --search OrderMgr
b2c logs get --search OrderMgr

Search for payment errors

搜索支付相关错误

b2c logs get --search "PaymentProcessor"
undefined
b2c logs get --search "PaymentProcessor"
undefined

Combined Filters

组合过滤

bash
undefined
bash
undefined

Recent errors containing "PaymentProcessor"

获取最近1小时内包含"PaymentProcessor"的错误日志

b2c logs get --since 1h --level ERROR --search "PaymentProcessor" --json
b2c logs get --since 1h --level ERROR --search "PaymentProcessor" --json

Last hour of errors and fatals from specific log types

获取最近1小时内特定日志类型的ERROR和FATAL级别日志

b2c logs get --filter error --filter warn --since 1h --level ERROR --level FATAL
undefined
b2c logs get --filter error --filter warn --since 1h --level ERROR --level FATAL
undefined

List Available Log Files

列出可用日志文件

bash
undefined
bash
undefined

List all log files

列出所有日志文件

b2c logs list
b2c logs list

List specific log types

列出特定类型的日志文件

b2c logs list --filter error --filter customerror
b2c logs list --filter error --filter customerror

JSON output

输出JSON格式

b2c logs list --json
undefined
b2c logs list --json
undefined

Real-Time Tailing (Human Use)

实时追踪日志(人工使用)

For interactive log monitoring (not for agents):
bash
undefined
如需交互式日志监控(不适用于Agent):
bash
undefined

Tail error and customerror logs

追踪错误日志和自定义错误日志

b2c logs tail
b2c logs tail

Tail specific log types

追踪特定类型的日志

b2c logs tail --filter debug --filter error
b2c logs tail --filter debug --filter error

Tail only ERROR and FATAL level entries

仅追踪ERROR和FATAL级别的日志条目

b2c logs tail --level ERROR --level FATAL
b2c logs tail --level ERROR --level FATAL

Tail with text search

结合文本搜索进行追踪

b2c logs tail --search "PaymentProcessor"
b2c logs tail --search "PaymentProcessor"

Combined filtering

组合过滤条件追踪

b2c logs tail --filter customerror --level ERROR --search "OrderMgr"
b2c logs tail --filter customerror --level ERROR --search "OrderMgr"

Stop with Ctrl+C

按Ctrl+C停止追踪

undefined
undefined

Downloading Full Log Files

下载完整日志文件

To download the complete log file, use the
file
field from the JSON output with
b2c-cli:b2c-webdav
:
bash
b2c webdav get error-odspod-0-appserver-20260126.log --root=logs -o -
如需下载完整日志文件,请使用JSON输出中的
file
字段配合
b2c-cli:b2c-webdav
bash
b2c webdav get error-odspod-0-appserver-20260126.log --root=logs -o -

JSON Output Structure

JSON输出结构

When using
--json
,
logs get
returns:
json
{
  "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|..."
    }
  ]
}
FieldDescription
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
使用
--json
参数时,
logs get
命令返回以下结构:
json
{
  "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|..."
    }
  ]
}
字段描述
file
源日志文件名(可配合
b2c-cli:b2c-webdav
下载完整文件)
level
日志级别:ERROR、WARN、INFO、DEBUG、FATAL、TRACE
timestamp
日志条目时间戳
message
日志消息(路径已标准化,支持IDE点击跳转)
raw
原始未处理的日志行

Log Types

日志类型

Common log file prefixes:
PrefixDescription
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
常见日志文件前缀:
前缀描述
error
系统错误日志
customerror
自定义脚本错误日志(
Logger.error()
生成)
warn
警告日志
debug
调试输出日志(启用后可见)
info
信息性消息日志
jobs
任务执行日志
api
API问题与违规日志
deprecation
已弃用API使用日志
quota
配额警告日志

More Commands

更多命令

See
b2c logs --help
for all available commands and options.
查看
b2c logs --help
获取所有可用命令和选项。

Related Skills

相关技能

  • b2c-cli:b2c-webdav
    - Direct WebDAV file access for downloading full log files
  • b2c-cli:b2c-config
    - Verify configuration and credentials
  • b2c-cli:b2c-webdav
    - 直接通过WebDAV访问文件,用于下载完整日志文件
  • b2c-cli:b2c-config
    - 验证配置和凭证