为什么Google Cloud Logging中的每个Python日志记录调用都有两个日志?

问题描述

我正在配置Python logging in my Google Cloud function

# Imports the Cloud Logging client library
import google.cloud.logging

# Instantiates a client
logclient = google.cloud.logging.Client()

# Imports Python logging module
import logging

# Retrieves a Cloud Logging handler based on the environment
# you're running in and integrates the handler with the
# Python logging module. By default this captures all logs
# at INFO level and higher
logclient.get_default_handler()
logclient.setup_logging(log_level=logging.INFO)

这是日志记录行:

logging.info(f'Creating invoice for {entity_id}')

此Google Cloud函数中没有其他带有该消息的日志记录行。

函数本身成功完成,没有任何错误

在Google Cloud Console中查看时,日志成功显示

但是,它被写为两个条目,相同的时间戳记,但严重性不同:

  1. INFO:这是我正在登录的正确级别
  2. 错误:为什么会出现?

Screenshot of logs showing the two entries

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)