AI Platform上所有日志的级别都是错误

问题描述 投票:0回答:2

在 Google AI Platform 上,所有打印在 stderr 上的日志都被解释为 ERROR。 有什么方法可以将日志打印为 INFO、WARNING 和 CRITICAL?

google-cloud-ml google-cloud-logging google-cloud-vertex-ai google-ai-platform gcp-ai-platform-training
2个回答
0
投票

查看 AI Platform 故障排除文档以了解 training logs。据说

You can put logging events in your application with standard Python libraries
,比如logging.

我没试过,但似乎你可以使用记录器对象类来设置所需的日志级别:

Logger.info(msg, *args, **kwargs)
Logs a message with level INFO on this logger. The arguments are interpreted as for debug().

Logger.warning(msg, *args, **kwargs)
Logs a message with level WARNING on this logger. The arguments are interpreted as for debug().

Logger.critical(msg, *args, **kwargs)
Logs a message with level CRITICAL on this logger. The arguments are interpreted as for debug().

0
投票

就我而言,我使用的是 FastAPI,它将所有日志发送到标准错误,导致 Cloud Logging 中的 ERROR 严重性。解决方案是添加一个 FastAPI 日志记录配置文件,而不是将日志发送到标准输出。然后,根据需要使用 Python 严重性。

© www.soinside.com 2019 - 2024. All rights reserved.