You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm setting up CloudLoggingHandler with a custom name to have an ability to filter log entries in Cloud Logging. But despite method I use to setup it up it doesn't work -
Given a Cloud Function (deployed as http triggered):
but not all message from a Cloud Function are logged with the default background transport.
As soon as I changed the transport to the SyncTransport I started seeing my messages:
from google.cloud.logging.handlers.transports import SyncTransport
handler = CloudLoggingHandler(client, name=LOGGER_NAME, transport=SyncTransport)
When it runs locally, it does flush the log queue:
Program shutting down, attempting to send 1 queued log entries to Cloud Logging...
Waiting up to 5 seconds.
Sent all pending logs.
but it seems not to happen while running in Cloud (Run).
The problem with initial code is that it doesn't use setup_logging (only logger.addHandler(handler)) and as so the default console handler is left and actually I saw output from it while messages from CloudLoggingHandler didn't appear at all.
I'm setting up CloudLoggingHandler with a custom name to have an ability to filter log entries in Cloud Logging. But despite method I use to setup it up it doesn't work -
Given a Cloud Function (deployed as http triggered):
logger.py
main.js
So I create a CloudLoggingHandler with my log name and added it to my Python logger. This is what suggested to do in official doc: https://cloud.google.com/python/docs/reference/logging/latest/handlers-cloud-logging
But it doesn't work in Cloud Functions
Here's how my log entry look like:

The logname field is still default stdout.
The text was updated successfully, but these errors were encountered: