GoogleCloudPlatform / opentelemetry-operations-java

Apache License 2.0
71 stars 41 forks source link

Change OTel quickstart to use log4j2 instead of logback #330

Closed aabmass closed 4 months ago

aabmass commented 4 months ago

Log4j2's JsonTemplateLayout supports most of the Cloud Logging special JSON keys directly through the GcpLayout event template. I still needed to map the OTel MDC keys for trace correlation, but am planning to contribute this upstream.

One outstanding issue is converting the trace_flags hex value to a boolean, but it doesn't break Cloud Console if logging.googleapis.com/trace_sampled key is unset/false. See https://github.com/apache/logging-log4j2/discussions/2482.

snippet-bot[bot] commented 4 months ago

Here is the summary of changes.

You are about to add 1 region tag. - [examples/instrumentation-quickstart/src/main/resources/log4j2.xml:21](https://github.com/aabmass/opentelemetry-operations-java/blob/e7dc0909dc2e988cd14651140342a17767529cf1/examples/instrumentation-quickstart/src/main/resources/log4j2.xml#L21), tag `opentelemetry_instrumentation_setup_logging`

This comment is generated by snippet-bot. If you find problems with this result, please file an issue at: https://github.com/googleapis/repo-automation-bots/issues. To update this comment, add snippet-bot:force-run label or use the checkbox below: