【发布时间】:2019-03-16 13:29:28
【问题描述】:
我正在谷歌灵活应用引擎中运行 python 3 应用程序。我正在使用默认的 python 根记录器,并希望能够查看 this image 中的日志级别。
使用 gunicorn 在 GAE 中部署具有以下日志配置的应用程序时:
import logging
logging.basicConfig(level=logging.INFO)
logging.warn('Warning level message')
所有日志级别都显示在 GAE 中的 any log level 下,与严重级别无关。
我尝试使用Stackdriver logging client for python:
import logging
from google.cloud import logging as gcloud_logging
client = gcloud_logging.Client()
client.setup_logging(logging.INFO)
logging.basicConfig(level=logging.INFO)
logging.warn('Warning level message')
在本地执行时,此日志会记录到 Stackdriver(在“全局”下),并且日志级别实际上运行正常。但是,当我在 GAE 中部署此应用程序时,GAE 的日志级别仍显示在“任何日志级别”下。此外,“全局”下的日志记录似乎不起作用。
是否有一种简单的方法可以让日志严重级别与带有 python 3 的谷歌标准应用引擎一起工作?
【问题讨论】:
-
将近 2 年没有 Google 方面的修复...
标签: python python-3.x google-app-engine google-cloud-platform stackdriver