Skip to content

feat(ops): structured JSON logging with request correlation IDs #28

Description

@trinhvandat

Context (P1 — operability)

Logs are plain-text with no request correlation — debugging multi-tenant production issues across requests is guesswork.

Scope

  • Servlet filter generating/propagating a request ID (X-Request-Id honored if present) into SLF4J MDC; include user id / environment key id when authenticated
  • Logback JSON encoder (logstash-logback-encoder) active in prod profile; human-readable pattern (with request ID) in dev
  • Request ID returned in error responses from GlobalExceptionHandler

Acceptance criteria

  • Every log line in prod profile is JSON with requestId, and userId/envId when available
  • Error responses carry the requestId for support correlation
  • Filter ordered before both security chains; MDC cleared after each request (test for leakage across requests)

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions