日誌#

日誌等級#

你可以透過 --log-level 選項來設定 Xinference 叢集的日誌等級。例如,以 DEBUG 日誌等級啟動 Xinference 本地叢集:

xinference-local --log-level debug

日誌檔案#

Xinference 支援滾動日誌檔案。預設情況下,當單一日誌檔案達到 100MB 時會產生新的日誌備份檔案,系統會保留最近的 30 份日誌備份。上述設定日誌等級的方式會同時影響命令列日誌和日誌檔案。

Environment Variables#

Xinference provides several environment variables to control logging behavior:

  • XINFERENCE_LOG_CONSOLE: Enable or disable console output (default: true). When set to false, logs are written only to files, and tqdm progress bars are captured and sampled.

  • XINFERENCE_LOG_FORMAT: Log format, either text (default) or json.

  • XINFERENCE_LOG_DOWNLOAD_PROGRESS: Control how download progress bars are logged when XINFERENCE_LOG_CONSOLE=false. Valid values are sampled (default, logs at 25/50/75/100% per file), full (logs every frame), or off (no progress logs).

Example usage:

# Disable console output, log download progress at sampling points
XINFERENCE_LOG_CONSOLE=false XINFERENCE_LOG_DOWNLOAD_PROGRESS=sampled xinference-local

# Disable console output, log every download progress frame
XINFERENCE_LOG_CONSOLE=false XINFERENCE_LOG_DOWNLOAD_PROGRESS=full xinference-local

# Disable console output, no download progress logs
XINFERENCE_LOG_CONSOLE=false XINFERENCE_LOG_DOWNLOAD_PROGRESS=off xinference-local

日誌目錄結構#

首先,所有的日誌儲存在 <XINFERENCE_HOME>/logs 目錄中,其中 <XINFERENCE_HOME> 的配置方式請參考 使用

其次,Xinference 在日誌目錄 <XINFERENCE_HOME>/logs 下建立一個子目錄。子目錄的名稱對應於 Xinference 集群啟動的時間(以毫秒為單位)。

本地部署#

在本地部署中,Xinference supervisor 和 Xinference workers 的日誌被合併到一個檔案中。日誌目錄結構如下所示:

<XINFERENCE_HOME>/logs
    └── local_1699503558105
        └── xinference.log

其中,1699503558105 是 Xinference 集群創建時的時間戳。因此,當你在本地多次創建集群時,可以根據此時間戳查找相應的日誌。

分散式部署#

在分散式部署中,Xinference supervisor 和 Xinference workers 分別在日誌目錄下建立自己的子目錄。子目錄的名稱以叢集角色名稱開頭,接著是啟動時間(以毫秒為單位)。如下所示:

<XINFERENCE_HOME>/logs
    └── supervisor_1699503558908
        └── xinference.log
        worker_1699503559105
        └── xinference.log