简体   繁体   English

如何抑制谷歌云日志记录的退出消息

[英]How to suppress exit message for google cloud logging

Google cloud logging is printing out this message when my (python) program exits:当我的(python)程序退出时,谷歌云日志会打印出这条消息:

Program shutting down, attempting to send 1 queued log entries to Stackdriver Logging...
Waiting up to 5 seconds.
Sent all pending logs.

I would like to suppress printing that message.我想禁止打印该消息。 Is there a config setting to control whether the message above does not get printed out when the program exits?是否有配置设置来控制程序退出时是否不打印上述消息? Thank you.谢谢你。

Use SyncTransport instead of the default BackgroundThreadTransport使用 SyncTransport 而不是默认的 BackgroundThreadTransport

from google.cloud.logging_v2.handlers import CloudLoggingHandler
from google.cloud.logging_v2.handlers.transports import SyncTransport
..........
client = google.cloud.logging.Client()
handler = CloudLoggingHandler(client, name="your_log_name", transport=SyncTransport)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM