|
| 1 | +<!-- |
| 2 | + Copyright 2024 Google LLC |
| 3 | +
|
| 4 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + you may not use this file except in compliance with the License. |
| 6 | + You may obtain a copy of the License at |
| 7 | +
|
| 8 | + https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +
|
| 10 | + Unless required by applicable law or agreed to in writing, software |
| 11 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + See the License for the specific language governing permissions and |
| 14 | + limitations under the License. |
| 15 | + --> |
| 16 | + |
| 17 | +<Configuration status="WARN"> |
| 18 | + <Appenders> |
| 19 | + <Console name="Console" target="SYSTEM_OUT"> |
| 20 | + <!-- TODO(#331): output logging.googleapis.com/trace_sampled as a boolean --> |
| 21 | + <!-- [START opentelemetry_instrumentation_setup_logging] --> |
| 22 | + <!-- Format JSON logs for the Cloud Logging agent |
| 23 | + https://cloud.google.com/logging/docs/structured-logging#special-payload-fields --> |
| 24 | + |
| 25 | + <!-- Log4j2's JsonTemplateLayout includes a template for Cloud Logging's special JSON fields |
| 26 | + https://logging.apache.org/log4j/2.x/manual/json-template-layout.html#event-templates --> |
| 27 | + <JsonTemplateLayout eventTemplateUri="classpath:GcpLayout.json"> |
| 28 | + <!-- Extend the included GcpLayout to include the trace and span IDs from Mapped |
| 29 | + Diagnostic Context (MDC) so that Cloud Logging can correlate Logs and Spans --> |
| 30 | + <EventTemplateAdditionalField |
| 31 | + key="logging.googleapis.com/trace" |
| 32 | + format="JSON" |
| 33 | + value='{"$resolver": "mdc", "key": "trace_id"}' |
| 34 | + /> |
| 35 | + <EventTemplateAdditionalField |
| 36 | + key="logging.googleapis.com/spanId" |
| 37 | + format="JSON" |
| 38 | + value='{"$resolver": "mdc", "key": "span_id"}' |
| 39 | + /> |
| 40 | + </JsonTemplateLayout> |
| 41 | + <!-- [END opentelemetry_instrumentation_setup_logging] --> |
| 42 | + </Console> |
| 43 | + </Appenders> |
| 44 | + <Loggers> |
| 45 | + <Root level="info"> |
| 46 | + <AppenderRef ref="Console" /> |
| 47 | + </Root> |
| 48 | + </Loggers> |
| 49 | +</Configuration> |
0 commit comments