Replies: 2 comments 3 replies
-
Hi @pwfarwell - it sounds like you are using the Java agent. What version of the agent and what version of |
Beta Was this translation helpful? Give feedback.
3 replies
-
Transferred this issue to |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Sorry for the long post... The only way to explain the issue is with an example.
We are trying to write traceIds in our logs using OpenTelemetery's log4j support. We're using otel java libraries from the maven 1.1 BOM import. We've added the traceId and spanId to the pattern in our log4j xml appender.
We're able to see traceIds and spanIds in our logs, but the results seem inconsistent - or we don't understand how OTEL's interaction with log4j works.
A traceId appears in log statements. But when I print out the traceId in the Span.current(), I see the "null" traceId "0000000000000000". So for the same log statement I see this:
{ ... "message":"traceId: 00000000000000000000000000000000", ... "traceId":"316241696e248bec34acc095076baad5" ...}
Here's the code example:
And here are the full log statements (all for the same threadId "50"):
When I create a new span and make it current, I now get a valid traceId from the span, but the logger continues to use the old traceId:
Log:
{... "message":"traceId: 7507140d35d466042a3b3d6f4715ddca", ... "traceId":"316241696e248bec34acc095076baad5" ...}
We want to control when the traceId in the logs changes.
In most cases, we want to set a traceId at the beginning of a thread and see that same traceId in the logs for the duration of the thread.
Any suggestions?
Beta Was this translation helpful? Give feedback.
All reactions