Ed McCormic Source on GitHub
All specs

Spring Boot and Java deep dives

Advanced Logging Patterns

Recreates a "money debited, order not created" incident so the whole story can be read by filtering on one requestId in Kibana.

View code on GitHub

Goals

  • A correlation ID filter that reuses or validates X-Request-Id, echoes it back, and cleans up only its own MDC keys
  • ID propagation across a real HTTP hop
  • MDC “backpack”: requestId, userId, orderId, paymentId
  • A readable log pattern locally and Logstash JSON elsewhere
  • Exceptions always passed as the last logging argument

Requirements

  • topErrors using a min-heap
  • ELK stack in Docker
  • Kibana dashboard showing errors by requestId

Changelog

  • 2026-09-28: Built, verified in Kibana, and published