← Back to Pull requests

feat: add aot-logback, a module that precompiles logback.xml into a Logback Configurator #517

Closed
unknown closed this pull request without merging on Oct 07, 2026 23:23 UTC
View on GitHub
unknown unknown commented on Sep 30, 2026 15:10 UTC
Author

Without a Configurator service, Logback parses logback.xml with Joran on the main thread at every start. micronaut-projects/micronaut-gradle-plugin#1380 and micronaut-projects/micronaut-maven-plugin#1722 ask to precompile it for every packaging, without an AOT run.

This PR adds the shared part, a new module, aot-logback (io.micronaut.aot:micronaut-aot-logback). The plugins and micronaut-runner call LogbackPrecompiler.precompile(Request) in-process and get a Result (status(), message(), entries(), warnings()). The generated LogbackConfigurator sets up Logback without loading Joran or java.xml. The engine is ported from alvarosanchez/micronaut-runner#201.

Behaviour

  • The engine stands down, and says why, on a logback.xml outside a small subset, a second logback.xml, an existing Configurator, a targetRelease below 25, Logback outside [1.5.37, 1.6), or an application/bootstrap file, in the application or a dependency, that may set logger.config or logback.configurationFile or use micronaut.config.import. The guide lists the rest.

  • A missing application root, or an earlier call's output left in one, is FAILED; under #516's rules the latter was a stand-down.

  • Unless the caller sets closedClassPath(true), ClassPathGuard hands over to Joran on any call where logback-test.xml is visible or logback.xml is missing or changed.

  • Run-time opt-out: -Dmicronaut.logback.precompiled=false.

  • Documented limit: a logger.config that only Micronaut's environment holds, such as --logger.config=… or distributed configuration, is not applied, even with the opt-out. Pass -Dlogger.config as a JVM option, or LOGGER_CONFIG. From Micronaut 5.3, Micronaut's logging refresh applies such a logger.config itself, whatever Configurator is registered: see micronaut-projects/micronaut-core#13400. A packaged file that may enable the distributed configuration client adds a line to Result.warnings().
  • Compatibility

  • Existing modules publish identical POMs and module metadata. build-logic splits aot-project into aot-base plus the platform, since this module publishes no dependency.

  • The API is @Internal, which japicmp exempts, not @Experimental.
  • Testing

  • Differential tests against Joran for both variants; forked-JVM tests for the run-time lookups; stand-down and warning cases in every configuration format.

  • CI and SonarCloud pass.
  • Startup (benchmark-large sample, time to first HTTP 200, paired medians with 95% CI; Apple M4 Pro, OpenJDK 25.0.4.1). Measured before the guard re-checked on later calls, which take well under 1 ms.

    | Mode | guarded − Joran | guard cost (guarded − closed) |
    |---|---|---|
    | Uncached, 4 × 30 pairs | −12.7 to −24.5 ms, all CIs exclude 0 | all CIs include 0 |
    | JDK AOT cache, 120 pairs | −7.3 ms [−11.4, −2.7] | +0.6 ms [−3.4, +5.5] |

    For reviewers

  • The tests are JUnit 5, like their sources; the repository otherwise uses Spock. Keep or rewrite?

  • Left for later: plugin wiring, micronaut-runner's switch, and logback.xml.to.java, which, run after precompilation, registers a second configurator; the plugin issues decide which wins.
  • Fixes #516

    🤖 Generated with Claude Code

    Diff: 407 lines (+305 / -102) across 5 files Reviewer: alvarosanchez Review duration: 10572m
    All Vouch review confidence checks passed
    Residual risk 0.27 = Change Risk (0.68) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.68 · 407 lines diff across 5 files
    0.68
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.360
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.068
    Real PR Conversation Timeline
    1 comments
    "Review active on #517"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 68% (HIGH) · Higher = larger blast radius
    68%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 26.9% · Safe to merge
    26.9%