gnodet opened a new pull request, #12810:
URL: https://github.com/apache/maven/pull/12810

   ## Summary
   
   Fixes #12730 — `mvn -q help:evaluate -DforceStdout` prints `[INFO] [stdout] 
value` instead of just `value`.
   
   **Root cause:** `doConfigureWithTerminalWithRawStreamsDisabled()` wraps 
`System.out` with a `LoggingOutputStream` that prefixes every line with `[INFO] 
[stdout]`. The stdout logger is hardcoded to `INFO_INT`, overriding the root 
logger's `ERROR` level set by `-q`. So the prefix leaks through even in quiet 
mode.
   
   **Fix:** Treat `-q`/`--quiet` the same as `--raw-streams` — when quiet mode 
is active, use the raw `System.out`/`System.err` streams directly (via 
`doConfigureWithTerminalWithRawStreamsEnabled`), bypassing the 
`LoggingOutputStream` wrapper entirely. This restores Maven 3 behavior where 
`-q` produced clean stdout suitable for scripting.
   
   This is a one-line condition change (adding `|| 
context.options().quiet().orElse(false)` to the existing `rawStreams` check). 
No new code paths, no behavioral change for non-quiet invocations.
   
   **Supersedes #12733** — that PR attempted to fix this by changing the stdout 
logger's level to `ERROR` when `-q` is used. However, since the output is 
emitted via `stdout.info("[stdout] " + s)`, setting the logger to ERROR 
suppresses the message *entirely* (both the prefix AND the value), resulting in 
silent output rather than clean output.
   
   ## Test plan
   - [ ] `mvn -q help:evaluate -Dexpression=project.name -DforceStdout` 
produces only the value (no `[INFO] [stdout]` prefix)
   - [ ] `mvn help:evaluate -Dexpression=project.name -DforceStdout` still 
shows `[INFO] [stdout] value` (non-quiet behavior unchanged)
   - [ ] `mvn --raw-streams help:evaluate -Dexpression=project.name 
-DforceStdout` still works (raw-streams behavior unchanged)
   - [ ] Existing IT `MavenITmng4387QuietLoggingTest` passes


-- 
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