You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by gn...@apache.org on 2026/10/23 09:09:31 UTC

(maven) branch feature/logging-foundation updated: fix: use WARNING instead of WARN in SimpleBuildEventListener log output

This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch feature/logging-foundation
in repository https://gitbox.apache.org/repos/asf/maven.git


The following commit(s) were added to refs/heads/feature/logging-foundation by this push:
     new ec124018fb fix: use WARNING instead of WARN in SimpleBuildEventListener log output
ec124018fb is described below

commit ec124018fb20f4bf617b01d80029cd659aba5915
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Fri Oct 23 09:09:20 2026 +0000

    fix: use WARNING instead of WARN in SimpleBuildEventListener log output
    
    LogLevel.WARN.name() produces 'WARN' but Maven's traditional console
    format uses '[WARNING]'. Map the level name in renderLevel() so that
    integration tests expecting '[WARNING]' in the output continue to pass.
---
 .../org/apache/maven/logging/SimpleBuildEventListener.java    | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/impl/maven-core/src/main/java/org/apache/maven/logging/SimpleBuildEventListener.java b/impl/maven-core/src/main/java/org/apache/maven/logging/SimpleBuildEventListener.java
index 7c911a58cb..54e0da7bb6 100644
--- a/impl/maven-core/src/main/java/org/apache/maven/logging/SimpleBuildEventListener.java
+++ b/impl/maven-core/src/main/java/org/apache/maven/logging/SimpleBuildEventListener.java
@@ -21,6 +21,7 @@
 import java.util.function.Consumer;
 
 import org.apache.maven.api.build.report.LogEvent;
+import org.apache.maven.api.build.report.LogLevel;
 import org.apache.maven.execution.ExecutionEvent;
 import org.eclipse.aether.transfer.TransferEvent;
 
@@ -40,7 +41,15 @@ public void projectStarted(String projectId) {}
 
     @Override
     public void projectLogMessage(String projectId, LogEvent event) {
-        log("[" + event.level() + "] " + event.message());
+        log("[" + renderLevel(event.level()) + "] " + event.message());
+    }
+
+    /**
+     * Renders the log level for console output.
+     * Maven traditionally uses {@code WARNING} rather than SLF4J's {@code WARN}.
+     */
+    protected String renderLevel(LogLevel level) {
+        return level == LogLevel.WARN ? "WARNING" : level.name();
     }
 
     @Override