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