# [DEPRECATED] App Engine Handler

3.16.0 (latest) 3.15.0 3.13.0 3.12.1 3.11.3 3.10.0 3.9.0 3.8.0 3.7.0 3.6.0 3.5.0 3.4.0 3.3.1 3.2.5 3.1.2 3.0.0 2.7.2 2.6.0 2.5.0 2.4.0 2.3.1 2.2.0 2.1.1 2.0.2 1.15.3 1.14.0 1.13.0 1.12.1 **Deprecated:** Deprecated since version 3.0.0: Use `CloudLoggingHandler` instead.

Logging handler for App Engine Flexible

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

### *class* google.cloud.logging_v2.handlers.app_engine.AppEngineHandler(client, \*, name='app', transport=\<class 'google.cloud.logging_v2.handlers.transports.background_thread.BackgroundThreadTransport'\>, stream=None)

Bases: [`logging.StreamHandler`](https://docs.python.org/3/library/logging.handlers.html#logging.StreamHandler)

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

DEPRECATED: use CloudLoggingHandler instead.

- **Parameters**

  - **client** ([*Client*](https://docs.cloud.google.com/python/docs/reference/logging/latest/client#google.cloud.logging_v2.client.Client)) -- The authenticated
    Google Cloud Logging client for this handler to use.

  - **name** (*Optional* *\[* [*str*](https://docs.python.org/3/library/stdtypes.html#str)*\]*) -- Name for the logger.

  - **transport** (*Optional* *\[* *Transport* *\]* ) -- The transport class. It should be a subclass
    of [`Transport`](https://docs.cloud.google.com/python/docs/reference/logging/latest/transport#google.cloud.logging_v2.handlers.transports.base.Transport). If unspecified,
    [`BackgroundThreadTransport`](https://docs.cloud.google.com/python/docs/reference/logging/latest/transport#google.cloud.logging_v2.handlers.transports.background_thread.BackgroundThreadTransport) will be used.

  - **stream** (*Optional* *\[* *IO* *\]*) -- Stream to be used by the handler.

#### emit(record)

Actually log the specified logging record.

Overrides the default emit behavior of `StreamHandler`.

See <https://docs.python.org/2/library/logging.html#handler-objects>

- **Parameters**

  **record** ([*logging.LogRecord*](https://docs.python.org/3/library/logging.html#logging.LogRecord)) -- The record to be logged.

#### get_gae_labels()

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.

- **Returns**

  Labels for GAE app.
- **Return type**

  [dict](https://docs.python.org/3/library/stdtypes.html#dict)

#### get_gae_resource()

Return the GAE resource using the environment variables.

- **Returns**

  Monitored resource for GAE.
- **Return type**

  [google.cloud.logging_v2.resource.Resource](https://docs.cloud.google.com/python/docs/reference/logging/latest/resource#google.cloud.logging_v2.resource.Resource)