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
feat: enable auto-population of missing metadata in logs and printing structured logs to stdout (#654)
* feat: add support for metadata auto-population and redirection to STDOUT (#649)
Add configuration to opt-out metadata auto-population.
Add configuration to redirect appender output to stdout.
Add relevant unit tests.
Refactor unit tests.
Improve javadoc comments for methods.
Remove warnings.
Make methods with no modifier to be private.
* 🦉 Updates from OwlBot
See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
* Use [`ILoggingEvent`](https://logback.qos.ch/apidocs/ch/qos/logback/classic/spi/ILoggingEvent.html) to update a log entry with [`LoggingEventEnhancer`]
* Enable [auto-population](https://github.com/googleapis/java-logging#auto-population-of-log-entrys-metadata) of the `LogEntry` metadata using the `autoPopulateMetadata` configuration flag.
81
+
82
+
#### Optimize log ingestion
83
+
84
+
By default, the appender will ingest log entries asynchronously by calling Logging API.
85
+
Multiple calls may be aggregated before being sent to improve use of API quota and bandwidth.
86
+
You can set the `writeSynchronicity` configuration flag to `SYNC` if they want to ingest log entries synchronously.
87
+
Note that configuring synchronous ingestion will probably result in performance penalties to your applications.
88
+
If you plan to deploy your application in one of Google Cloud managed environments (e.g. Cloud Run, Cloud Function or App Engine),
89
+
you can leverage the support provided by the implicit logging agent and the [structured logging](https://cloud.google.com/logging/docs/structured-logging) feature.
90
+
To use it, set the `redirectToStdout` configuration flag to `true`.
91
+
This flag instructs the appender to print the log entries to `stdout` instead of ingesting them using Logging API.
92
+
The log entries are printed using the [structured logging Json format](https://cloud.google.com/logging/docs/structured-logging#special-payload-fields).
93
+
In result, the logging agent will be responsible for ingesting the logs to Logging API.
94
+
Note that using the structured logging Json format you cannot control the log name where the logs will be ingested.
95
+
The logs will be ingested into the project that hosts the environment where your application is running.
96
+
The configuration `logDestinationProjectId` will be ignored.
* Use [`ILoggingEvent`](https://logback.qos.ch/apidocs/ch/qos/logback/classic/spi/ILoggingEvent.html) to update a log entry with [`LoggingEventEnhancer`]
* Enable [auto-population](https://github.com/googleapis/java-logging#auto-population-of-log-entrys-metadata) of the `LogEntry` metadata using the `autoPopulateMetadata` configuration flag.
152
+
153
+
#### Optimize log ingestion
154
+
155
+
By default, the appender will ingest log entries asynchronously by calling Logging API.
156
+
Multiple calls may be aggregated before being sent to improve use of API quota and bandwidth.
157
+
You can set the `writeSynchronicity` configuration flag to `SYNC` if they want to ingest log entries synchronously.
158
+
Note that configuring synchronous ingestion will probably result in performance penalties to your applications.
159
+
If you plan to deploy your application in one of Google Cloud managed environments (e.g. Cloud Run, Cloud Function or App Engine),
160
+
you can leverage the support provided by the implicit logging agent and the [structured logging](https://cloud.google.com/logging/docs/structured-logging) feature.
161
+
To use it, set the `redirectToStdout` configuration flag to `true`.
162
+
This flag instructs the appender to print the log entries to `stdout` instead of ingesting them using Logging API.
163
+
The log entries are printed using the [structured logging Json format](https://cloud.google.com/logging/docs/structured-logging#special-payload-fields).
164
+
In result, the logging agent will be responsible for ingesting the logs to Logging API.
165
+
Note that using the structured logging Json format you cannot control the log name where the logs will be ingested.
166
+
The logs will be ingested into the project that hosts the environment where your application is running.
167
+
The configuration `logDestinationProjectId` will be ignored.
0 commit comments