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

   ## Summary
   
   Backport four Log-related improvements from master 
([#12572](https://github.com/apache/maven/pull/12572)) to the 4.0.x branch for 
inclusion in rc-7:
   
   - **`Log.trace()`** — new trace level (SLF4J TRACE / JUL FINEST) to separate 
Maven core internals from user-facing debug messages. Currently `-X` floods 
debug output with resolver/interpolation details that drown user-relevant 
diagnostics.
   - **`Log.child(name)`** — creates a sub-logger with an independently 
filterable name (e.g. `CompilerMojo.diagnostics`), letting plugin 
sub-components log under their own namespace.
   - **Logger name alignment** — Maven 4 `Log` now uses the mojo implementation 
class name (e.g. `org.apache.maven.plugins.compiler.CompilerMojo`) instead of 
the goal name (`compiler:compile`). This matches what Maven 3 mojos already use 
and enables standard SLF4J hierarchical level configuration.
   - **Mojo MDC propagation** — sets `maven.mojo.id` 
(`prefix:goal@executionId`) in the SLF4J MDC during mojo execution. All log 
messages — including those arriving through the JUL-to-SLF4J bridge — now carry 
mojo context, available to any SLF4J appender via `%X{maven.mojo.id}`.
   
   Also fixes a pre-existing bug where `DefaultLog.warn(Supplier, Throwable)` 
delegated to `logger.info()` instead of `logger.warn()`.
   
   ## Files changed
   
   | File | Change |
   |---|---|
   | `Log.java` | Add `trace()` methods + `child()` default method |
   | `DefaultLog.java` | Implement trace + child + fix warn bug |
   | `DefaultMavenPluginManager.java` | `getFullGoalName()` → 
`getImplementation()` |
   | `DefaultBuildPluginManager.java` | `getFullGoalName()` → 
`getImplementation()` |
   | `ProjectBuildLogAppender.java` | Add `maven.mojo.id` MDC key + 
`setMojoId()` |
   | `LoggingExecutionListener.java` | Set/clear mojoId MDC on mojo start/end |
   
   ## Test plan
   
   - [x] `mvn test -pl impl/maven-core` passes locally
   - [ ] CI on maven-4.0.x branch
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


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