You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by el...@apache.org on 2023/03/11 13:18:52 UTC

[maven] 01/01: MNG-7724 don't warn about unsupported SLF4J configs; no one cares

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

elharo pushed a commit to branch MNG-7724
in repository https://gitbox.apache.org/repos/asf/maven.git

commit 51f1165cec5e0f82be1e40e0623b2ce70ad5d22a
Author: Elliotte Rusty Harold <el...@ibiblio.org>
AuthorDate: Sat Mar 11 08:17:53 2023 -0500

    MNG-7724 don't warn about unsupported SLF4J configs; no one cares
---
 .../cli/logging/Slf4jConfigurationFactory.java     |  2 +-
 .../impl/UnsupportedSlf4jBindingConfiguration.java | 36 +++++-----------------
 2 files changed, 9 insertions(+), 29 deletions(-)

diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfigurationFactory.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfigurationFactory.java
index 8f5d7688a..92fa07d19 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfigurationFactory.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfigurationFactory.java
@@ -67,6 +67,6 @@ public class Slf4jConfigurationFactory {
             e.printStackTrace();
         }
 
-        return new UnsupportedSlf4jBindingConfiguration(slf4jBinding, supported);
+        return new UnsupportedSlf4jBindingConfiguration();
     }
 }
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/UnsupportedSlf4jBindingConfiguration.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/UnsupportedSlf4jBindingConfiguration.java
index 837997dfb..7f76a06d1 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/UnsupportedSlf4jBindingConfiguration.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/UnsupportedSlf4jBindingConfiguration.java
@@ -23,43 +23,23 @@ import java.util.Map;
 import java.util.Set;
 
 import org.apache.maven.cli.logging.BaseSlf4jConfiguration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
- * Pseudo-configuration for unsupported slf4j binding.
+ * Pseudo-configuration for unsupported SLF4J binding.
  *
  * @author Hervé Boutemy
  * @since 3.2.4
  */
 public class UnsupportedSlf4jBindingConfiguration extends BaseSlf4jConfiguration {
-    private static final Logger LOGGER = LoggerFactory.getLogger(UnsupportedSlf4jBindingConfiguration.class);
 
-    private String slf4jBinding;
+    /**
+     * @deprecated the arguments are ignored. Use the no-args constructor.
+     */
+    @Deprecated
+    public UnsupportedSlf4jBindingConfiguration(String slf4jBinding, Map<URL, Set<Object>> supported) {}
 
-    private Map<URL, Set<Object>> supported;
-
-    public UnsupportedSlf4jBindingConfiguration(String slf4jBinding, Map<URL, Set<Object>> supported) {
-        this.slf4jBinding = slf4jBinding;
-        this.supported = supported;
-    }
+    public UnsupportedSlf4jBindingConfiguration() {}
 
     @Override
-    public void activate() {
-        LOGGER.warn("The SLF4J binding actually used is not supported by Maven: {}", slf4jBinding);
-        LOGGER.warn("Maven supported bindings are:");
-
-        String ls = System.lineSeparator();
-
-        for (Map.Entry<URL, Set<Object>> entry : supported.entrySet()) {
-            StringBuilder sb = new StringBuilder();
-            sb.append("(from ").append(entry.getKey().toExternalForm()).append(')');
-
-            for (Object binding : entry.getValue()) {
-                sb.append(ls).append("- ").append(binding);
-            }
-
-            LOGGER.warn(sb.toString());
-        }
-    }
+    public void activate() {}
 }