[Bug] log4j2 All Loggers Asynchronous report to skywalking does not display traceId
Search before asking
- [X] I had searched in the issues and found no similar issues.
Apache SkyWalking Component
Java Agent (apache/skywalking-java)
What happened
Use log4j2 to print logs asynchronous(All Loggers Asynchronous), the format is json, and there is no traceId on the web ui
What you expected to happen
UI web displays traceID
How to reproduce
Configure the lo4j2 log as All Loggers Asynchronous, the log format as Json, and the traceId is not displayed on the reported skywalking
Anything else
No response
Are you willing to submit PR?
- [x] Yes I am willing to submit a PR!
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
Async writer is not supported, because getTraceId is not in the correct context.
Check doc first https://skywalking.apache.org/docs/skywalking-java/v8.10.0/en/setup/service-agent/java-agent/application-toolkit-log4j-2.x/
There are several difference usages.
Asynchronous means that it does not support display on the ui?
Read doc, before asking
1、The log print format is configured as
PatternLayout charset="UTF-8" pattern="[%d][%t][%p][%c:%L][%X{X-B3-TraceId}] %m%n"/>
can print normally traceId
2、The log print format is configured as json
<JsonLayout eventEol="true" compact="true">
<KeyValuePair key="timestamp" value="$${date:yyyy-MM-dd HH:mm:ss.SSS}" />
<KeyValuePair key="projectName" value="unm" />
<KeyValuePair key="podName" value="vfr" />
</JsonLayout>
can not print normally traceId
why?
1、The log print format is configured as
PatternLayout charset="UTF-8" pattern="[%d][%t][%p][%c:%L][%X{X-B3-TraceId}] %m%n"/>can print normally traceId 2、The log print format is configured as json<JsonLayout eventEol="true" compact="true"> <KeyValuePair key="timestamp" value="$${date:yyyy-MM-dd HH:mm:ss.SSS}" /> <KeyValuePair key="projectName" value="unm" /> <KeyValuePair key="podName" value="vfr" /> </JsonLayout>can not print normally traceId why?
me too