jamesfredley opened a new pull request, #15694:
URL: https://github.com/apache/grails-core/pull/15694

   ## Summary
   
   Grails Forge generated `grails-app/conf/logback-spring.xml` with 
`<withJansi>true</withJansi>` on non-Windows operating systems. This breaks 
console logging after the first Spring Boot DevTools restart.
   
   ## Root cause
   
   - Jansi's `AnsiConsole.systemInstall()` globally replaces 
`System.out`/`System.err` and tracks installation with a static reference 
counter. That state lives in the Spring Boot DevTools **base** classloader, so 
it survives restarts.
   - Logback's `ConsoleAppender` calls `systemInstall()` on `start()` but never 
calls `systemUninstall()` on `stop()`. After the first DevTools restart, the 
old appender closes the shared Jansi stream while the counter stays above zero, 
so `systemInstall()` is a no-op and the new appender writes to a closed, stale 
stream. Console logging then silently stops - exactly the reported behavior 
(works at startup, dies after the first reload).
   - Spring Boot deliberately does **not** enable Jansi in its own logback 
defaults; it renders ANSI colors via its own `AnsiOutput` and the `%clr` 
converter, which does not replace `System.out`. There is therefore no benefit 
to enabling Jansi.
   
   ## Change
   
   - Always generate `<withJansi>false</withJansi>` and remove the 
now-pointless OS-based toggle in `Logback`, making Forge consistent with the 
base profile skeleton (which already hardcodes `false`).
   - Add a `LogbackSpec` regression test asserting the generated config 
disables Jansi for every application type.
   
   ## Verification
   
   - `:grails-forge-core:compileJava` passes and the generated Rocker template 
emits the literal `<withJansi>false</withJansi>`.
   - New `LogbackSpec` test covers all application types.
   
   Fixes #15663
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to