-
In our application, traceIds and spanIds don't consistently appear in our Log4j logs. We are using otel 1.1 with manual instrumentation. I have the logging.pattern in my application.properties. I have a simple SpringBoot app to demonstrate the problem. In the demo, I create a new span inside a new thread. I don't see any traceIds injected into the logs. Code snippet:
Logs:
I see the new traceId/spanId have been created, but they aren't injected into the logs (even during the current scope of the span). Here are the dependencies in my maven pom.xml:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
Hi @pwfarwell . The issue here is that spring boot, by default, is using logback as the logging implementation, not log4j2. If you want to have the logging implementation be log4j2, you'll need to tweak your pom a bit:
I tried this locally, and it worked fine. Also, I recommend keeping your opentelemetry versions in sync:
|
Beta Was this translation helpful? Give feedback.
Hi @pwfarwell .
The issue here is that spring boot, by default, is using logback as the logging implementation, not log4j2. If you want to have the logging implementation be log4j2, you'll need to tweak your pom a bit:
I tried this locally, and it worked fine.
A…