Skip to content

Best practice for routing logs per module in Spring Modulith (Logback configuration) #1266

Description

@vincentlejeune

Hi,

I'm working on a modular monolith with Spring Modulith and Logback, and I’d like to route logs to separate files per module (e.g., order.log, payment.log, etc.) to improve diagnostics and monitoring.

I know there are approaches using SiftingAppender with MDC or TurboFilter, but I’d like to understand if there’s a more idiomatic or built-in solution with Spring Modulith, perhaps leveraging module metadata or observability integration.

Specifically, I’d appreciate guidance on:

  • Recommendations for combining Spring Modulith, Logback, and SiftingAppender (or similar) to route logs per module.
  • Whether there is a Modulith-provided hook (like a span attribute or module identifier) that can be automatically propagated into the MDC.
  • Any existing official or community templates, starter configurations, or extension points that support this log separation strategy.

A sample configuration or reference would be extremely helpful!

Thanks for your work on Modulith

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions