MNG-7724 don't warn about unsupported SLF4J configs; no one cares (#1051)

This commit is contained in:
Elliotte Rusty Harold 2023-03-11 14:13:02 -05:00 committed by GitHub
parent 57d5587cf8
commit 2d85d13ee8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 29 deletions

View File

@ -67,6 +67,6 @@ public class Slf4jConfigurationFactory {
e.printStackTrace();
}
return new UnsupportedSlf4jBindingConfiguration(slf4jBinding, supported);
return new UnsupportedSlf4jBindingConfiguration();
}
}

View File

@ -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() {}
}