1 package org.apache.maven.cli.logging.impl;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.net.URL;
23 import java.util.Map;
24 import java.util.Set;
25
26 import org.apache.maven.cli.logging.BaseSlf4jConfiguration;
27 import org.slf4j.Logger;
28 import org.slf4j.LoggerFactory;
29
30
31
32
33
34
35
36 public class UnsupportedSlf4jBindingConfiguration
37 extends BaseSlf4jConfiguration
38 {
39 private final Logger logger = LoggerFactory.getLogger( UnsupportedSlf4jBindingConfiguration.class );
40
41 private String slf4jBinding;
42
43 private Map<URL, Set<Object>> supported;
44
45 public UnsupportedSlf4jBindingConfiguration( String slf4jBinding, Map<URL, Set<Object>> supported )
46 {
47 this.slf4jBinding = slf4jBinding;
48 this.supported = supported;
49 }
50
51 @Override
52 public void activate()
53 {
54 logger.warn( "The SLF4J binding actually used is not supported by Maven: {}", slf4jBinding );
55 logger.warn( "Maven supported bindings are:" );
56
57 String ls = System.lineSeparator();
58
59 for ( Map.Entry<URL, Set<Object>> entry : supported.entrySet() )
60 {
61 StringBuilder sb = new StringBuilder();
62 sb.append( "(from " ).append( entry.getKey().toExternalForm() ).append( ')' );
63
64 for ( Object binding : entry.getValue() )
65 {
66 sb.append( ls ).append( "- " ).append( binding );
67 }
68
69 logger.warn( sb.toString() );
70 }
71 }
72 }