skywalking icon indicating copy to clipboard operation
skywalking copied to clipboard

[Feature] Log4j2 Asynchronous log print traceId

Open it-ll opened this issue 4 years ago • 2 comments

Search before asking

  • [X] I had searched in the issues and found no similar feature requirement.

Description

1、The log print format is configured as PatternLayout charset="UTF-8" pattern="[%d][%t][%p][%c:%L][%traceId] %m%n"/> can print traceId [2022-04-26 15:15:14,355][RMI TCP Connection(3)-127.0.0.1][INFO][com.zaxxer.hikari.HikariDataSource:][TID: 55ccfd16d32b4327a2efdf346325163a.136.16509573127970001] HikariPool-1 - Start completed. [2022-04-26 15:15:39,179][http-nio-5011-exec-1][INFO][com.opay.saas.devops.provider.TestErrorProvider:][TID: 55ccfd16d32b4327a2efdf346325163a.112.16509573386460001] test error1 [2022-04-26 15:15:39,190][http-nio-5011-exec-1][ERROR][com.opay.saas.tools.exception.ExceptionHandler:][TID: 55ccfd16d32b4327a2efdf346325163a.112.16509573386460001] global exception handler 2、The log print format is configured as json can not print traceId {"instant":{"epochSecond":1650958872,"nanoOfSecond":758000000},"thread":"http-nio-5011-exec-1","level":"INFO","loggerName":"com.opay.saas.tools.i18n.Translator","message":"language is empty, set default: English","endOfBatch":false,"loggerFqcn":"org.apache.logging.slf4j.Log4jLogger","skyWalkingDynamicField":{"traceId":"N/A"},"threadId":109,"threadPriority":5,"timestamp":"2022-04-26 15:41:12.758"} {"instant":{"epochSecond":1650958872,"nanoOfSecond":758000000},"thread":"http-nio-5011-exec-1","level":"INFO","loggerName":"com.opay.saas.tools.i18n.Translator","message":"Translator translate operation-failed result:Failed","endOfBatch":true,"loggerFqcn":"org.apache.logging.slf4j.Log4jLogger","skyWalkingDynamicField":{"traceId":"N/A"},"threadId":109,"threadPriority":5,"timestamp":"2022-04-26 15:41:12.758"} why?

Use case

No response

Related issues

No response

Are you willing to submit a PR?

  • [ ] Yes I am willing to submit a PR!

Code of Conduct

it-ll avatar Apr 26 '22 07:04 it-ll

The log print format is configured as json <JsonLayout eventEol="true" compact="true"> </JsonLayout>

it-ll avatar Apr 26 '22 07:04 it-ll

I think this discussion is there for a long time.

wu-sheng avatar Apr 26 '22 07:04 wu-sheng