日志#
日志等级#
你可以通过 --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 tofalse, logs are written only to files, and tqdm progress bars are captured and sampled.XINFERENCE_LOG_FORMAT: Log format, eithertext(default) orjson.XINFERENCE_LOG_DOWNLOAD_PROGRESS: Control how download progress bars are logged whenXINFERENCE_LOG_CONSOLE=false. Valid values aresampled(default, logs at 25/50/75/100% per file),full(logs every frame), oroff(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