改成输出最后50行错误日志

This commit is contained in:
weixin_46229132 2025-04-27 15:02:54 +08:00
parent d1285e6064
commit a101084194

View File

@ -87,8 +87,8 @@ class ODMProcessMonitor:
# 获取容器的错误日志
error_msg = container.logs(
stderr=True).decode("utf-8").splitlines()
self.logger.error("容器运行失败的详细错误日志:")
for line in error_msg:
self.logger.error("容器运行失败的最后 50 行错误日志:")
for line in error_msg[-50:]:
self.logger.error(line)
container.remove()
time.sleep(5)