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
{{ message }}
This repository was archived by the owner on Feb 6, 2026. It is now read-only.
#### Alternative way to ingest logs in Google Cloud managed environments
139
+
140
+
If you use Java logger with the Cloud Logging Handler, you can configure the handler to output logs to `stdout` using
141
+
the [structured logging Json format](https://cloud.google.com/logging/docs/structured-logging#special-payload-fields).
142
+
To do this, add `com.google.cloud.logging.LoggingHandler.redirectToStdout=true` to the logger configuration file.
143
+
You can use this configuration when running applications in Google Cloud managed environments such as AppEngine, Cloud Run,
144
+
Cloud Function or GKE. The logger agent installed on these environments can capture STDOUT and ingest it into Cloud Logging.
145
+
The agent can parse structured logs printed to STDOUT and capture additional log metadata beside the log payload.
146
+
The parsed information includes severity, source location, user labels, http request and tracing information.
147
+
148
+
#### Auto-population of log entrys' metadata
149
+
150
+
LogEntry object metadata information such as [monitored resource](https://cloud.google.com/logging/docs/reference/v2/rest/v2/MonitoredResource),
151
+
[Http request](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#HttpRequest) or
(new ContextHandler()).setCurrentContext(context);
179
+
```
180
+
181
+
* Using [servlet initializer](https://github.com/googleapis/java-logging-servlet-initializer).
182
+
If your application uses a Web server based on Jakarta servlets (e.g. Jetty or Tomcat), you can add the servlet initializer
183
+
package to your WAR. The package implements a service provider interface (SPI) for
#### Alternative way to ingest logs in Google Cloud managed environments
239
+
240
+
If you use Java logger with the Cloud Logging Handler, you can configure the handler to output logs to `stdout` using
241
+
the [structured logging Json format](https://cloud.google.com/logging/docs/structured-logging#special-payload-fields).
242
+
To do this, add `com.google.cloud.logging.LoggingHandler.redirectToStdout=true` to the logger configuration file.
243
+
You can use this configuration when running applications in Google Cloud managed environments such as AppEngine, Cloud Run,
244
+
Cloud Function or GKE. The logger agent installed on these environments can capture STDOUT and ingest it into Cloud Logging.
245
+
The agent can parse structured logs printed to STDOUT and capture additional log metadata beside the log payload.
246
+
The parsed information includes severity, source location, user labels, http request and tracing information.
247
+
248
+
#### Auto-population of log entrys' metadata
249
+
250
+
LogEntry object metadata information such as [monitored resource](https://cloud.google.com/logging/docs/reference/v2/rest/v2/MonitoredResource),
251
+
[Http request](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#HttpRequest) or
(new ContextHandler()).setCurrentContext(context);
279
+
```
280
+
281
+
* Using [servlet initializer](https://github.com/googleapis/java-logging-servlet-initializer).
282
+
If your application uses a Web server based on Jakarta servlets (e.g. Jetty or Tomcat), you can add the servlet initializer
283
+
package to your WAR. The package implements a service provider interface (SPI) for
<!-- see http://www.mojohaus.org/clirr-maven-plugin/examples/ignored-differences.html -->
0 commit comments