You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Ralph Goers (Jira)" <ji...@apache.org> on 2021/12/02 06:28:00 UTC

[jira] [Comment Edited] (LOG4J2-3200) Log4j2 compatibility with Open Telemetry

    [ https://issues.apache.org/jira/browse/LOG4J2-3200?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17452196#comment-17452196 ] 

Ralph Goers edited comment on LOG4J2-3200 at 12/2/21, 6:27 AM:
---------------------------------------------------------------

I have been doing the equivalent (at least as I understand it) of open telemetry since the first version of Log4j2. See https://logging.apache.org/log4j-audit/latest/requestContext.html as the support for that is built into Log4j Audit. To support open telemetry you would have to specify the trace_id and span_id to the RequestContext and use that instead of the requestId and sessionId shown.

I came across a couple open source libraries that support Log4j2 as part of looking into the answer for this. You might look at them. 




was (Author: ralph.goers@dslextreme.com):
I have been doing the equivalent (at least as I understand it) of open telemetry since the first version of Log4j2. See https://logging.apache.org/log4j-audit/latest/requestContext.html as the support for that is built into Log4j Audit. To support open telemetry you would have to specify the trace_id and span_id to the RequestContext and use that instead of the requestId and sessionId shown.



> Log4j2 compatibility with Open Telemetry
> ----------------------------------------
>
>                 Key: LOG4J2-3200
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3200
>             Project: Log4j 2
>          Issue Type: Question
>          Components: Filters
>            Reporter: Rémi C.
>            Priority: Blocker
>
> Hello,
>   I am trying to fetch the trace id generated by open telemetry with only configuration in log4j2.xml file and web.xml file.
>   I created a stack overflow ticket, see : [https://stackoverflow.com/questions/70194344/how-to-access-request-header-value-with-log4j2]
>  
>   Is it possible with the log4j2 lookup to be compatible with open telemetry?
>   I tried to use ${web:header.traceId} and it just does not work. I have followed the config. So, am I missing something to make it work?
>   I saw that even without the web.xml config I added, the ${web:rootDir} still works.
>   There is almost no information on the internet on how to make it work with Open Telemetry so I am asking to the expert here. Open Telemetry is basically a field/value that is set in the HTTP request header.
>  
> Thank you



--
This message was sent by Atlassian Jira
(v8.20.1#820001)