Skip to content

Commit

Permalink
[pinpoint-apm#11290] log4j-it, update TraceId value check
Browse files Browse the repository at this point in the history
  • Loading branch information
yjqg6666 committed Jul 26, 2024
1 parent d57a5be commit 3d4f9d2
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ protected void checkMDC() {
logger.error("maru");

checkVersion(logger);

Assertions.assertNotNull(MDC.get("PtxId"), "txId");
Object ptxId = MDC.get("PtxId");
Assertions.assertNotNull(ptxId, "TxId");
Assertions.assertInstanceOf(String.class, ptxId, "TxId type");
String id = (String) ptxId;
Assertions.assertTrue(id.contains("build.test.0^1"), "TxId value");
Assertions.assertNotNull(MDC.get("PspanId"), "spanId");
}

Expand All @@ -51,6 +54,7 @@ public void run() {
Assertions.assertNotNull(log, "log null");
Assertions.assertTrue(log.contains(msg), "contains msg");
Assertions.assertTrue(log.contains("TxId"), "contains TxId");
Assertions.assertTrue(log.contains("build.test.0^1"), "contains TxId value");

Assertions.assertNotNull(logger, "logger null");
checkVersion(logger);
Expand Down

0 comments on commit 3d4f9d2

Please sign in to comment.