顯示來自執行中的開發代理實例的日誌。
概要
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
引數
沒有
選項
| 名稱 | 說明 | 允許的值 | 預設值 |
|---|---|---|---|
-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、 5m2h1d)2026-01-24T14:00:00Z |
n/a |
備註
當你執行多個 Dev Proxy 實例(使用 --as-system-proxy false),請使用 --pid 顯示特定實例日誌的選項。
如果你沒特別指定 --pid 且有多個實例在執行,Dev Proxy 會顯示註冊為系統代理的實例的日誌。 如果沒有實例被註冊為系統代理,Dev Proxy 會顯示最近啟動實例的日誌。 在日誌之前,Dev Proxy 會列印通知,標示所選實例並列出其他執行實例的程序 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.
Dev Proxy 會把這份通知寫入標準錯誤串流(stderr),因此不會影響你管道或重定向到檔案的日誌輸出。
這個選項會 --since 依照完整日期和時間篩選日誌條目,因此也會排除較早幾天記錄的條目。 如果時間戳沒有包含時區偏移,Dev Proxy 會使用當地時區。 Dev Proxy 會依請求開始的時間來篩選,所以即使請求在指定時間前開始,也不會顯示出來。 當你與 --follow結合--since時,開發代理也會對新的日誌條目套用篩選。