显示正在运行的开发代理实例中的日志。
概要
devproxy logs [options]
Options:
-f, --follow Follow log output
-n, --lines <N> Number of lines to show from the end of the log
--since <time> Show logs since timestamp (e.g. '2026-01-24T14:00:00'
or '5m' for 5 minutes ago)
--pid <pid> Show logs from a specific instance
--log-level <log-level> Level of messages to log
--no-color Disable colored output
--output <format> Output format
-h, --help Show help
用法
devproxy logs
Arguments
没有
选项
| 名称 | 说明 | 允许的值 | 默认 |
|---|---|---|---|
-f、--follow |
遵循日志输出(结尾 -f 样式) | n/a | n/a |
--lines、-n <N> |
要从日志末尾显示的行数 | 整数 | 50 |
--log-level <log-level> |
要记录的消息级别 |
Trace、Debug、Information、Warning、Error、Critical、None |
Information |
--no-color |
禁用彩色输出 | n/a | n/a |
--output <format> |
输出格式 |
Text、Json |
Text |
--pid <pid> |
按进程 ID 显示来自特定开发代理实例的日志 | 整数 | n/a |
--since <time> |
显示自指定日期和时间或相对时间以来的日志 | ISO 8601 日期和时间(例如,2026-01-24T14:00:00或)或相对时间(以秒、分钟、小时或天为单位(例如,、30s、5m、2h1d)2026-01-24T14:00:00Z |
n/a |
注解
运行多个开发代理实例(使用 --as-system-proxy false)时,请使用此选项 --pid 显示来自特定实例的日志。
如果未指定 --pid 且多个实例正在运行,则开发代理会显示注册为系统代理的实例中的日志。 如果未将实例注册为系统代理,则开发代理会显示最近启动的实例中的日志。 在日志之前,开发代理会打印一个通知,该通知标识所选实例并列出其他正在运行的实例的进程 ID:
Multiple Dev Proxy instances are running. Showing logs from PID 4888 (most recently started instance). Other instances: 4837. Use --pid to show logs from a specific instance.
开发代理将此通知写入标准错误流(stderr),因此不会影响通过管道传送或重定向到文件的日志输出。
该 --since 选项按其完整日期和时间筛选日志条目,因此它还排除在前几天记录的条目。 如果时间戳不包括时区偏移量,则开发代理使用本地时区。 开发代理按启动时间筛选每个请求,因此即使以后完成,也不会显示指定时间之前启动的请求。 结合使用--since--follow时,开发代理还会将筛选器应用于新的日志条目。