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

Rémi C. commented on LOG4J2-3200:
---------------------------------

Hi Ralph,
  Thank you for the answer. I am looking at my options here.

  The log4j-audit is asking to implement some code and I am looking to insert 
it in multiple applications with only configuration.

  I thought that was possible with Log4jServletFilter because it require to 
only modify the web.xml.

  In that perspective, I would prefer a solution that require only to change 
the configuration because I am not sure if the trace_id is in the 
RequestContext. In Dynatrace, they who the trace id under the request header 
section.

  Briefly, 3 questions.

1- Can Log4jServletFilter access a custom trace id in the request header? I see 
that we can access a web:header.name in the doc (see: 
[https://github.com/apache/logging-log4j2/blob/master/src/site/asciidoc/manual/lookups.adoc)]

2- Is the RequestContext part of the requestHeader? 
([https://stackoverflow.com/questions/48882641/remove-request-context-from-response-header).]
 If so, then can I access it with the Log4jServletFilter? Is Open Telemetry 
suppose to be in the Request-Context?

3- Does log4j audit can work with a combination of configuration and a common 
library that would hold the classes or it need to be implemented in each 
application?

 

I found that Log4jServletFilter was a really interesting solution.

> 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)

Reply via email to