TraceId and TransactionId stop displaying in Console Appender after running Java application with -javaagent

Hi Jack, thanks for the quick response!

When I run the API previously without all of the changes or the javaagent, and hit a test endpoint, the logs displayed something like this:

2023-08-22 06:53:36,845 DEBUG [98935a7860566ab937fcb59e49bb41b2 5be4a64964f07f4b] o.s.c.l.LogFormatUtils: GET "/api/v1", parameters={} 
2023-08-22 06:53:36,853 INFO  [98935a7860566ab937fcb59e49bb41b2 5be4a64964f07f4b] c.p.p.f.a.v.HealthCheckController: v1 healthy af 
2023-08-22 06:53:36,873 DEBUG [98935a7860566ab937fcb59e49bb41b2 5be4a64964f07f4b] o.s.w.s.FrameworkServlet: Completed 200 OK 

The logback pattern used was [%blue(%X{traceId}) %magenta(%X{spanId})]

when you look at Elastic APM UI (which is in Kibana) you can see the transactions? Is that correct? In what way do you see the transactions

Here is the test endpoint, which simply calls an open endpoint on a second instance running locally:

    @Operation(summary = "Health check tracing via rest template")
    @RequestMapping(value = "trace/rt/{port}", method = RequestMethod.GET)
    public ResponseEntity<ResponseMessage<Object>> healthTraceRestTemplate(@PathVariable int port) {

        String url = "http://localhost:" + port + "/api/v1";

        Map<String, String> headers = new HashMap<>();

        RequestEntity<Map<String, String>> request = new RequestEntity<>(null, HttpMethod.GET, URI.create(url));

        log.info("sending request to other service"); // Since we're in an observation scope - this log line will contain tracing MDC entries ...
        ResponseEntity<ResponseMessage> response = restTemplate.getForEntity(URI.create(url), ResponseMessage.class); // Boot's RestTemplate instrumentation creates a child span here
        log.info("got response [{}]", response); // ... so will this line

        String message = new HealthyMessage().getMessage("trace");
        log.info(message);
        return ResponseEntity.ok().body(ResponseMessage.aResponse().withCode(HttpStatus.OK).withMessage(message).withStatus(ResponseMessage.Status.success).build());
    }

When I run both with the javaagent, I see it in the UI, but not the waterfall showing the second service being called:

Clicking it shows this trace.id: 1ed657d4c88e176808edac54c63e3053

The other service shows the endpoint was hit, with the correct traceparent: 00-1ed657d4c88e176808edac54c63e3053-2ec7259ff58b7c80-01 and also shows the correct trace.id