As of January 1, 2020 this library no longer supports Python 2 on the latest released version. Library versions released prior to that date will continue to be available. For more information please visit Python 2 support on Google Cloud.

Google App Engine flexible Log Handler

Logging handler for App Engine Flexible

Sends logs to the Cloud Logging API with the appropriate resource and labels for App Engine logs.

class, *, name='app', transport=<class ''>, stream=None)[source]

Bases: logging.StreamHandler

A logging handler that sends App Engine-formatted logs to Stackdriver.

  • client (Client) – The authenticated Google Cloud Logging client for this handler to use.

  • name (Optional[str]) – Name for the logger.

  • transport (Optional[Transport]) – The transport class. It should be a subclass of Transport. If unspecified, BackgroundThreadTransport will be used.

  • stream (Optional[IO]) – Stream to be used by the handler.


Actually log the specified logging record.

Overrides the default emit behavior of StreamHandler.



record (logging.LogRecord) – The record to be logged.


Return the labels for GAE app.

If the trace ID can be detected, it will be included as a label. Currently, no other labels are included.


Labels for GAE app.

Return type



Return the GAE resource using the environment variables.


Monitored resource for GAE.

Return type