2

Google cloud logging is printing out this message when my (python) program exits:

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.

user3450049
  • 825
  • 1
  • 10
  • 20
  • It looks like intended behavior and some of the messages you can found in [source code](https://googleapis.dev/python/logging/latest/_modules/google/cloud/logging/handlers/transports/background_thread.html) of cloud logging. What's wrong with it? – Serhii Rohoza Nov 04 '20 at 08:10

1 Answers1

1

Use SyncTransport instead of the default 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)