Need Help : Not injecting span_id and trace_id in log #11947
-
I have created a simple Maven project using Intellij, and I have written a code for accepting an HTTP request. We are using manual instrumentation. I have followed the following documentation : https://help.sumologic.com/docs/apm/traces/get-started-transaction-tracing/opentelemetry-instrumentation/java/traceid-spanid-injection-into-logs-configuration/ I expect to see the actual trace id and span id but not able to see it in the logs. Can someone please help where I need to change |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Are you able to upload this code to github for review? it might be easier to assist in troubleshooting with more context |
Beta Was this translation helpful? Give feedback.
-
I refer https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/logback/logback-appender-1.0/library this as well |
Beta Was this translation helpful? Give feedback.
Firstly, we provide 2 appenders for logback. One is for exporting logs via otlp and the other one is for for injecting trace and span id into log. You are using the wrong one, you need https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/logback/logback-mdc-1.0/library. Secondly trace/span id is injected based on the span that is current in the context. You need to change your code that creates the span to