Skip to content

Set up async structured JSON logging in analytics microservice #35056

@freddyDOTCMS

Description

@freddyDOTCMS

Description

Configure Logback with AsyncAppender and logstash-logback-encoder for structured JSON log output. Apply structured logging across all layers: Controller, Service, Repository.

Every log entry must include standardized fields: customerId, requestId, timestamp, layer, durationMs, endpoint, queryParams, eventType, environment.

The correlation ID must survive the @Async boundary — propagate via AsyncConfig's TaskDecorator, following the same pattern as CustomerContext.

Parent epic: #35048

Acceptance Criteria

  • Logback configured with AsyncAppender + logstash-logback-encoder
  • All layers (Controller, Service, Repository) emit structured JSON logs
  • All standard fields present on every log entry: customerId, requestId, timestamp, layer, durationMs, endpoint, queryParams, eventType, environment
  • Correlation ID propagated through @Async boundary via AsyncConfig TaskDecorator

Additional Context

  • Source task: Task 6 (Async structured JSON logging) from the improvement plan
  • Blocked by: Refactor analytics service ingest code #35050 (ingest code refactor)
  • This logging standard is a prerequisite for Task 7 (Fix GlobalExceptionHandler logging)
  • Related branch: issue-34849-Add-dotCMS-Analytics-Proxy-Endpoint-for-/v1/analytics/-to-dot-ca-event-manager

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions