如何解决为什么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中查看时,日志成功显示。
但是,它被写为两个条目,相同的时间戳记,但严重性不同:
- INFO:这是我正在登录的正确级别
- 错误:为什么会出现?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。