Fix generated logback-spring.xml hiding WARN and INFO messages#15973
Conversation
The starter file set the root logger to ERROR, suppressing the WARN and INFO output — including framework startup warnings — that Spring Boot shows by default. Raise the root level to INFO and compose Spring Boot's own defaults.xml and console-appender.xml instead of duplicating the console appender, so the generated configuration matches Spring Boot's defaults. Applied to both generation paths: the Grails Forge template (logback.rocker.raw) and the profile CLI base skeleton (grails-profiles/base/skeleton), so create-app and start.grails.org produce the same file. The commented development logger example in the skeleton now uses the @grails.codegen.defaultPackage@ placeholder instead of a hardcoded package name.
🚨 TestLens detected 8 failed tests 🚨Here is what you can do:
Test SummaryCI / Build Grails-Core (ubuntu-latest, 21) > :grails-datamapping-core:test
CI / Build Grails-Core (ubuntu-latest, 25) > :grails-datamapping-core:test
CI / Build Grails-Core (windows-latest, 25) > :grails-datamapping-core:test
CI / Build Grails-Core Rerunning all Tasks (ubuntu-latest, 21) > :grails-datamapping-core:test
🏷️ Commit: a5ef545 Test FailuresWhereQueryClosureCaptureSpec > association criteria closures capture only the variables they reference (:grails-datamapping-core:test in CI / Build Grails-Core (ubuntu-latest, 21))WhereQueryClosureCaptureSpec > generated closure constructors are identical across compilations (:grails-datamapping-core:test in CI / Build Grails-Core (ubuntu-latest, 21))WhereQueryClosureCaptureSpec > association criteria closures capture only the variables they reference (:grails-datamapping-core:test in CI / Build Grails-Core (ubuntu-latest, 25))WhereQueryClosureCaptureSpec > generated closure constructors are identical across compilations (:grails-datamapping-core:test in CI / Build Grails-Core (ubuntu-latest, 25))WhereQueryClosureCaptureSpec > association criteria closures capture only the variables they reference (:grails-datamapping-core:test in CI / Build Grails-Core (windows-latest, 25))WhereQueryClosureCaptureSpec > generated closure constructors are identical across compilations (:grails-datamapping-core:test in CI / Build Grails-Core (windows-latest, 25))WhereQueryClosureCaptureSpec > association criteria closures capture only the variables they reference (:grails-datamapping-core:test in CI / Build Grails-Core Rerunning all Tasks (ubuntu-latest, 21))WhereQueryClosureCaptureSpec > generated closure constructors are identical across compilations (:grails-datamapping-core:test in CI / Build Grails-Core Rerunning all Tasks (ubuntu-latest, 21))Muted TestsNote Checks are currently running using the configuration below. Select tests to mute in this pull request: 🔲 WhereQueryClosureCaptureSpec > association criteria closures capture only the variables they reference Reuse successful test results: 🔲 ♻️ Only rerun the tests that failed or were muted before Click the checkbox to trigger a rerun: 🔲 Rerun jobs Learn more about TestLens at testlens.app. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 8.0.x #15973 +/- ##
=============================================
Coverage 19.5852% 19.5852%
Complexity 308 308
=============================================
Files 61 61
Lines 3472 3472
Branches 601 601
=============================================
Hits 680 680
Misses 2662 2662
Partials 130 130 🚀 New features to boost your workflow:
|
|
@jamesfredley I am merging this to ensure log output for the M3. If you still disagree with any if this, lets fix in a subsequent PR? |
…figuration feature With the generated file's content fixes landed separately in apache#15973 (simplified to compose Spring Boot's defaults with an INFO root level), flip this PR back to its original intent: newly generated applications ship no logback-spring.xml at all. - Profile skeleton: remove grails-app/conf/logback-spring.xml. - Forge: the default logback feature only adds the grails-logging dependency; Spring Boot's zero-config Logback defaults apply. A new visible logback-config feature (Logback Configuration) generates the simplified starter file on demand and supersedes the default feature. - Docs: the logging reference and upgrade guide describe zero-config logging as the default for new applications, application.yml level tuning (including per-environment via the environments block), when to add logback-spring.xml, and the boundaries between the two modes. - Tests: LogbackSpec asserts no file is generated by default and that logback-config emits the simplified configuration with grails-logging declared exactly once.
Summary
The starter
grails-app/conf/logback-spring.xmlgenerated for new applications sets the root logger toERROR, which suppresses the WARN and INFO output — including framework startup warnings — that Spring Boot shows by default.This PR raises the root level to
INFOand composes Spring Boot's owndefaults.xmlandconsole-appender.xmlinstead of duplicating the console appender, so the generated configuration matches Spring Boot's defaults. Jansi remains unused; Spring Boot's%clrconverter supplies console colors (see #15663).The change is applied to both generation paths so
create-appand start.grails.org produce the same file:grails-profiles/base/skeleton/grails-app/conf/logback-spring.xml(also fixes the commented development logger example to use the@grails.codegen.defaultPackage@placeholder instead of a hardcoded package name)grails-forge-corelogback.rocker.rawtemplate, withLogbackSpecupdated to assert the new contentThis is the logback-spring.xml portion of #15757, extracted into its own PR. The opt-in zero-config Forge feature and documentation changes remain in #15757.
Testing
grails-forge-coretest suite passes, including the updatedLogbackSpecassertions (Spring Boot includes present,INFOroot level, developmentspringProfile, no Jansi) across all application types.