gnodet commented on code in PR #12694:
URL: https://github.com/apache/maven/pull/12694#discussion_r4046244547
##########
api/maven-api-core/src/main/java/org/apache/maven/api/plugin/Log.java:
##########
@@ -87,8 +87,6 @@ default void trace(Throwable error) {}
* The supplier is only evaluated if trace is enabled.
* <p>
* The default implementation is a no-op for backward compatibility.
- *
- * @param content the message supplier
*/
default void trace(Supplier<String> content) {}
Review Comment:
Fixed in 222071d770: restored `@param content` tag on
`trace(Supplier<String> content)`.
##########
api/maven-api-core/src/main/java/org/apache/maven/api/plugin/Log.java:
##########
@@ -97,9 +95,6 @@ default void trace(Supplier<String> content) {}
* The supplier is only evaluated if trace is enabled.
* <p>
* The default implementation is a no-op for backward compatibility.
- *
- * @param content the message supplier
- * @param error the error that caused this log
*/
default void trace(Supplier<String> content, Throwable error) {}
Review Comment:
Fixed in 222071d770: restored both `@param content` and `@param error` tags
on `trace(Supplier<String> content, Throwable error)`.
##########
impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/LookupInvoker.java:
##########
@@ -447,12 +457,31 @@ protected Consumer<String> doDetermineWriter(C context) {
}
protected void activateLogging(C context) throws Exception {
- if (!SLF4JBridgeHandler.isInstalled()) {
- SLF4JBridgeHandler.removeHandlersForRootLogger();
- SLF4JBridgeHandler.install();
+ if (!MavenJulHandler.isInstalled()) {
+ MavenJulHandler.install();
}
context.slf4jConfiguration.activate();
+
+ // Now that SLF4J is fully initialized, set the JUL root logger level
+ // to match the effective log level. This must happen AFTER install()
+ // + activate() to avoid flooding JUL events during SLF4J bootstrap
+ // (ConcurrentHashMap.computeIfAbsent reentrancy).
+ // In quiet mode keep the JUL root at WARNING so that INFO/DEBUG JUL
+ // events are suppressed at source — relying solely on the SLF4J-level
+ // check in MavenJulHandler.isLevelEnabled() is racy: newly created
+ // SLF4J loggers may briefly see the default INFO level before
+ // quiet-mode propagation completes, leaking output that
+ // MavenITmng4387QuietLoggingTest detects as a flaky failure.
+ java.util.logging.Level julRootLevel;
+ if (context.options().quiet().orElse(false)) {
+ julRootLevel = java.util.logging.Level.WARNING;
+ } else if (context.invokerRequest.effectiveVerbose()) {
+ julRootLevel = java.util.logging.Level.ALL;
+ } else {
+ julRootLevel = java.util.logging.Level.INFO;
+ }
+
java.util.logging.LogManager.getLogManager().getLogger("").setLevel(julRootLevel);
Review Comment:
Fixed in 222071d770: changed `Level.WARNING` to `Level.SEVERE` in quiet
mode. Updated the comment to explain that SEVERE matches the SLF4J ERROR
threshold exactly, suppressing both INFO and WARNING JUL events at source
during the race window.
--
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]