Repository: maven Updated Branches: refs/heads/slf4j-gossip [created] 3f9df1ed0
Replace slf4j-simple with gossip. Project: http://git-wip-us.apache.org/repos/asf/maven/repo Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/58cdef37 Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/58cdef37 Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/58cdef37 Branch: refs/heads/slf4j-gossip Commit: 58cdef37fa3ee4a695bee1dbc35a80ecc50af10f Parents: 202f757 Author: Tamas Cservenak <ta...@cservenak.net> Authored: Sat Jan 9 01:20:07 2016 +0100 Committer: Tamas Cservenak <ta...@cservenak.net> Committed: Sat Jan 9 01:20:07 2016 +0100 ---------------------------------------------------------------------- apache-maven/pom.xml | 12 ++- .../org.sonatype.gossip/config.properties | 29 +++++++ .../src/conf/logging/simplelogger.properties | 25 ------ maven-embedder/pom.xml | 13 ++- .../maven/cli/logging/Slf4jConfiguration.java | 2 +- .../cli/logging/Slf4jConfigurationFactory.java | 48 +---------- .../cli/logging/impl/GossipConfiguration.java | 62 ++++++++++++++ .../cli/logging/impl/Log4j2Configuration.java | 59 ------------- .../cli/logging/impl/LogbackConfiguration.java | 61 -------------- .../maven/cli/logging/impl/MavenRenderer.java | 89 ++++++++++++++++++++ .../logging/impl/Slf4jSimpleConfiguration.java | 63 -------------- .../UnsupportedSlf4jBindingConfiguration.java | 72 ---------------- .../main/java/org/slf4j/MavenSlf4jFriend.java | 35 -------- .../org/slf4j/impl/MavenSlf4jSimpleFriend.java | 40 --------- .../maven/slf4j-configuration.properties | 22 ----- pom.xml | 22 +++-- 16 files changed, 217 insertions(+), 437 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven/blob/58cdef37/apache-maven/pom.xml ---------------------------------------------------------------------- diff --git a/apache-maven/pom.xml b/apache-maven/pom.xml index 2d00468..17b952e 100644 --- a/apache-maven/pom.xml +++ b/apache-maven/pom.xml @@ -88,8 +88,16 @@ <artifactId>aether-transport-wagon</artifactId> </dependency> <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-simple</artifactId> + <groupId>org.sonatype.gossip</groupId> + <artifactId>gossip-slf4j</artifactId> + </dependency> + <dependency> + <groupId>org.sonatype.gossip</groupId> + <artifactId>gossip-extra</artifactId> + </dependency> + <dependency> + <groupId>org.fusesource.jansi</groupId> + <artifactId>jansi</artifactId> </dependency> </dependencies> http://git-wip-us.apache.org/repos/asf/maven/blob/58cdef37/apache-maven/src/conf/logging/META-INF/org.sonatype.gossip/config.properties ---------------------------------------------------------------------- diff --git a/apache-maven/src/conf/logging/META-INF/org.sonatype.gossip/config.properties b/apache-maven/src/conf/logging/META-INF/org.sonatype.gossip/config.properties new file mode 100644 index 0000000..48ef947 --- /dev/null +++ b/apache-maven/src/conf/logging/META-INF/org.sonatype.gossip/config.properties @@ -0,0 +1,29 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +version=1.0.0 +profiles=maven + +profile.maven.triggers=always +profile.maven.trigger.always=org.sonatype.gossip.trigger.AlwaysTrigger +profile.maven.listeners=console +profile.maven.listener.console=org.sonatype.gossip.listener.ConsoleListener +profile.maven.listener.console.renderer=org.apache.maven.cli.logging.impl.MavenRenderer +profile.maven.listener.console.renderer.pattern=%m%n%x +profile.maven.listener.console.renderer.colorize=true + +profile.maven.logger.root=INFO http://git-wip-us.apache.org/repos/asf/maven/blob/58cdef37/apache-maven/src/conf/logging/simplelogger.properties ---------------------------------------------------------------------- diff --git a/apache-maven/src/conf/logging/simplelogger.properties b/apache-maven/src/conf/logging/simplelogger.properties deleted file mode 100644 index 859ff72..0000000 --- a/apache-maven/src/conf/logging/simplelogger.properties +++ /dev/null @@ -1,25 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -org.slf4j.simpleLogger.defaultLogLevel=info -org.slf4j.simpleLogger.showDateTime=false -org.slf4j.simpleLogger.showThreadName=false -org.slf4j.simpleLogger.showLogName=false -org.slf4j.simpleLogger.logFile=System.out -org.slf4j.simpleLogger.levelInBrackets=true -org.slf4j.simpleLogger.log.Sisu=info -org.slf4j.simpleLogger.warnLevelString=WARNING \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven/blob/58cdef37/maven-embedder/pom.xml ---------------------------------------------------------------------- diff --git a/maven-embedder/pom.xml b/maven-embedder/pom.xml index 2cfa670..b0cce1c 100644 --- a/maven-embedder/pom.xml +++ b/maven-embedder/pom.xml @@ -75,13 +75,18 @@ <artifactId>slf4j-api</artifactId> </dependency> <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-simple</artifactId> + <groupId>org.sonatype.gossip</groupId> + <artifactId>gossip-slf4j</artifactId> + <optional>true</optional> + </dependency> + <dependency> + <groupId>org.sonatype.gossip</groupId> + <artifactId>gossip-extra</artifactId> <optional>true</optional> </dependency> <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> + <groupId>org.fusesource.jansi</groupId> + <artifactId>jansi</artifactId> <optional>true</optional> </dependency> <!-- CLI --> http://git-wip-us.apache.org/repos/asf/maven/blob/58cdef37/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfiguration.java ---------------------------------------------------------------------- diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfiguration.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfiguration.java index 5f4b64d..f64f330 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfiguration.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfiguration.java @@ -28,7 +28,7 @@ package org.apache.maven.cli.logging; */ public interface Slf4jConfiguration { - public static enum Level + enum Level { DEBUG, INFO, ERROR } http://git-wip-us.apache.org/repos/asf/maven/blob/58cdef37/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfigurationFactory.java ---------------------------------------------------------------------- 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 1a68d76..4b1a31e 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 @@ -19,61 +19,19 @@ package org.apache.maven.cli.logging; * under the License. */ -import java.io.IOException; -import java.net.URL; -import java.util.Enumeration; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Properties; -import java.util.Set; - -import org.apache.maven.cli.logging.impl.UnsupportedSlf4jBindingConfiguration; -import org.codehaus.plexus.util.PropertyUtils; +import org.apache.maven.cli.logging.impl.GossipConfiguration; import org.slf4j.ILoggerFactory; /** - * Slf4jConfiguration factory, loading implementations from <code>META-INF/maven/slf4j-configuration.properties</code> - * configuration files in class loader: key is the class name of the ILoggerFactory, value is the class name of - * the corresponding Slf4jConfiguration. + * Slf4jConfiguration factory that just "hides" the Gossip from MavenCli. * * @author Hervé Boutemy * @since 3.1.0 */ public class Slf4jConfigurationFactory { - public static final String RESOURCE = "META-INF/maven/slf4j-configuration.properties"; - public static Slf4jConfiguration getConfiguration( ILoggerFactory loggerFactory ) { - Map<URL, Set<Object>> supported = new LinkedHashMap<>(); - - String slf4jBinding = loggerFactory.getClass().getCanonicalName(); - - try - { - Enumeration<URL> resources = Slf4jConfigurationFactory.class.getClassLoader().getResources( RESOURCE ); - - while ( resources.hasMoreElements() ) - { - URL resource = resources.nextElement(); - - Properties conf = PropertyUtils.loadProperties( resource.openStream() ); - - String impl = conf.getProperty( slf4jBinding ); - - if ( impl != null ) - { - return (Slf4jConfiguration) Class.forName( impl ).newInstance(); - } - - supported.put( resource, conf.keySet() ); - } - } - catch ( IOException | ClassNotFoundException | IllegalAccessException | InstantiationException e ) - { - e.printStackTrace(); - } - - return new UnsupportedSlf4jBindingConfiguration( slf4jBinding, supported ); + return new GossipConfiguration(); } } http://git-wip-us.apache.org/repos/asf/maven/blob/58cdef37/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/GossipConfiguration.java ---------------------------------------------------------------------- diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/GossipConfiguration.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/GossipConfiguration.java new file mode 100644 index 0000000..2714020 --- /dev/null +++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/GossipConfiguration.java @@ -0,0 +1,62 @@ +package org.apache.maven.cli.logging.impl; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.sonatype.gossip.Gossip; +import org.sonatype.gossip.Gossip.LoggerImpl; + +import org.apache.maven.cli.logging.BaseSlf4jConfiguration; + +/** + * Configuration for gossip-slf4j. + * + * @author Tamas Cservenak + * @since 3.3.9 + */ +public class GossipConfiguration + extends BaseSlf4jConfiguration +{ + org.sonatype.gossip.Level value = org.sonatype.gossip.Level.INFO; + + @Override + public void setRootLoggerLevel( Level level ) + { + switch ( level ) + { + case DEBUG: + value = org.sonatype.gossip.Level.DEBUG; + break; + + case ERROR: + value = org.sonatype.gossip.Level.ERROR; + break; + + default: + throw new IllegalArgumentException( "Unknown level:" + level ); + } + } + + @Override + public void activate() + { + LoggerImpl root = Gossip.getInstance().getRoot(); + root.setLevel( value ); + } +} http://git-wip-us.apache.org/repos/asf/maven/blob/58cdef37/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Log4j2Configuration.java ---------------------------------------------------------------------- diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Log4j2Configuration.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Log4j2Configuration.java deleted file mode 100644 index b24ea9c..0000000 --- a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Log4j2Configuration.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.apache.maven.cli.logging.impl; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.apache.maven.cli.logging.BaseSlf4jConfiguration; - -/** - * Configuration for slf4j-log4j2. - * - * @author Hervé Boutemy - * @since 3.1.0 - */ -public class Log4j2Configuration - extends BaseSlf4jConfiguration -{ - @Override - public void setRootLoggerLevel( Level level ) - { - String value; - switch ( level ) - { - case DEBUG: - value = "debug"; - break; - - case INFO: - value = "info"; - break; - - default: - value = "error"; - break; - } - System.setProperty( "maven.logging.root.level", value ); - } - - @Override - public void activate() - { - // no op - } -} http://git-wip-us.apache.org/repos/asf/maven/blob/58cdef37/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/LogbackConfiguration.java ---------------------------------------------------------------------- diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/LogbackConfiguration.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/LogbackConfiguration.java deleted file mode 100644 index 5d9fab7..0000000 --- a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/LogbackConfiguration.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.apache.maven.cli.logging.impl; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.apache.maven.cli.logging.BaseSlf4jConfiguration; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Configuration for slf4j-logback. - * - * @author Hervé Boutemy - * @since 3.1.0 - */ -public class LogbackConfiguration - extends BaseSlf4jConfiguration -{ - @Override - public void setRootLoggerLevel( Level level ) - { - ch.qos.logback.classic.Level value; - switch ( level ) - { - case DEBUG: - value = ch.qos.logback.classic.Level.DEBUG; - break; - - case INFO: - value = ch.qos.logback.classic.Level.INFO; - break; - - default: - value = ch.qos.logback.classic.Level.ERROR; - break; - } - ( (ch.qos.logback.classic.Logger) LoggerFactory.getLogger( Logger.ROOT_LOGGER_NAME ) ).setLevel( value ); - } - - @Override - public void activate() - { - // no op - } -} http://git-wip-us.apache.org/repos/asf/maven/blob/58cdef37/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/MavenRenderer.java ---------------------------------------------------------------------- diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/MavenRenderer.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/MavenRenderer.java new file mode 100644 index 0000000..f6bd306 --- /dev/null +++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/MavenRenderer.java @@ -0,0 +1,89 @@ +package org.apache.maven.cli.logging.impl; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.sonatype.gossip.Event; +import org.sonatype.gossip.Level; +import org.sonatype.gossip.render.PatternRenderer; + +import static org.fusesource.jansi.Ansi.Attribute.INTENSITY_BOLD; +import static org.fusesource.jansi.Ansi.Color.DEFAULT; +import static org.fusesource.jansi.Ansi.Color.RED; +import static org.fusesource.jansi.Ansi.Color.YELLOW; +import static org.fusesource.jansi.Ansi.ansi; + +/** + * Maven specific renderer. + * + * @author Tamas Cservenak + * @since 3.3.9 + */ +public class MavenRenderer + extends PatternRenderer +{ + private boolean colorize = false; // be on safe side + + public boolean isColorize() + { + return colorize; + } + + public void setColorize( final boolean colorize ) + { + this.colorize = colorize; + } + + @Override + public String render( final Event event ) + { + String buff = super.render( event ); + if ( colorize ) + { + return colorize( event.getLevel(), buff ); + } + else + { + return buff; + } + } + + private String colorize( final Level level, final String buff ) + { + assert level != null; + assert buff != null; + + switch ( level ) + { + case TRACE: + case DEBUG: + return ansi().a( INTENSITY_BOLD ).fg( YELLOW ).a( buff ).reset().toString(); + + case INFO: + return ansi().a( INTENSITY_BOLD ).fg( DEFAULT ).a( buff ).reset().toString(); + + case WARN: + case ERROR: + return ansi().a( INTENSITY_BOLD ).fg( RED ).a( buff ).reset().toString(); + + default: + throw new IllegalArgumentException( "Unknown level: " + level ); + } + } +} http://git-wip-us.apache.org/repos/asf/maven/blob/58cdef37/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java ---------------------------------------------------------------------- diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java deleted file mode 100644 index 3961059..0000000 --- a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.apache.maven.cli.logging.impl; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.apache.maven.cli.logging.BaseSlf4jConfiguration; -import org.slf4j.MavenSlf4jFriend; -import org.slf4j.impl.MavenSlf4jSimpleFriend; - -/** - * Configuration for slf4j-simple. - * - * @author Hervé Boutemy - * @since 3.1.0 - */ -public class Slf4jSimpleConfiguration - extends BaseSlf4jConfiguration -{ - @Override - public void setRootLoggerLevel( Level level ) - { - String value; - switch ( level ) - { - case DEBUG: - value = "debug"; - break; - - case INFO: - value = "info"; - break; - - default: - value = "error"; - break; - } - System.setProperty( "org.slf4j.simpleLogger.defaultLogLevel", value ); - } - - @Override - public void activate() - { - // property for root logger level or System.out redirection need to be taken into account - MavenSlf4jFriend.reset(); - MavenSlf4jSimpleFriend.init(); - } -} http://git-wip-us.apache.org/repos/asf/maven/blob/58cdef37/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/UnsupportedSlf4jBindingConfiguration.java ---------------------------------------------------------------------- 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 deleted file mode 100644 index 2e91b25..0000000 --- a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/UnsupportedSlf4jBindingConfiguration.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.apache.maven.cli.logging.impl; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.net.URL; -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. - * - * @author Hervé Boutemy - * @since 3.2.4 - */ -public class UnsupportedSlf4jBindingConfiguration - extends BaseSlf4jConfiguration -{ - private final Logger logger = LoggerFactory.getLogger( UnsupportedSlf4jBindingConfiguration.class ); - - private String slf4jBinding; - - private Map<URL, Set<Object>> supported; - - public UnsupportedSlf4jBindingConfiguration( String slf4jBinding, Map<URL, Set<Object>> supported ) - { - this.slf4jBinding = slf4jBinding; - this.supported = supported; - } - - @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.getProperty( "line.separator" ); - - 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() ); - } - } -} http://git-wip-us.apache.org/repos/asf/maven/blob/58cdef37/maven-embedder/src/main/java/org/slf4j/MavenSlf4jFriend.java ---------------------------------------------------------------------- diff --git a/maven-embedder/src/main/java/org/slf4j/MavenSlf4jFriend.java b/maven-embedder/src/main/java/org/slf4j/MavenSlf4jFriend.java deleted file mode 100644 index 8a43053..0000000 --- a/maven-embedder/src/main/java/org/slf4j/MavenSlf4jFriend.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.slf4j; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * Utility for Maven to access Slf4j internals through package access. - * Use with precaution, since this is not normally intended for production use. - */ -public class MavenSlf4jFriend -{ - /** - * Reset Slf4j internal state. - */ - public static void reset() - { - LoggerFactory.reset(); - } -} http://git-wip-us.apache.org/repos/asf/maven/blob/58cdef37/maven-embedder/src/main/java/org/slf4j/impl/MavenSlf4jSimpleFriend.java ---------------------------------------------------------------------- diff --git a/maven-embedder/src/main/java/org/slf4j/impl/MavenSlf4jSimpleFriend.java b/maven-embedder/src/main/java/org/slf4j/impl/MavenSlf4jSimpleFriend.java deleted file mode 100644 index bffd18c..0000000 --- a/maven-embedder/src/main/java/org/slf4j/impl/MavenSlf4jSimpleFriend.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.slf4j.impl; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.slf4j.ILoggerFactory; -import org.slf4j.LoggerFactory; - -/** - * Utility for Maven to access Slf4j-Simple internals through package access. - * Use with precaution, since this is not normally intended for production use. - */ -public class MavenSlf4jSimpleFriend -{ - public static void init() - { - SimpleLogger.init(); - ILoggerFactory loggerFactory = LoggerFactory.getILoggerFactory(); - if ( loggerFactory instanceof SimpleLoggerFactory ) - { - ( (SimpleLoggerFactory) loggerFactory ).reset(); - } - } -} http://git-wip-us.apache.org/repos/asf/maven/blob/58cdef37/maven-embedder/src/main/resources/META-INF/maven/slf4j-configuration.properties ---------------------------------------------------------------------- diff --git a/maven-embedder/src/main/resources/META-INF/maven/slf4j-configuration.properties b/maven-embedder/src/main/resources/META-INF/maven/slf4j-configuration.properties deleted file mode 100644 index cd01f9e..0000000 --- a/maven-embedder/src/main/resources/META-INF/maven/slf4j-configuration.properties +++ /dev/null @@ -1,22 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# key = Slf4j effective logger factory implementation -# value = corresponding o.a.m.cli.logging.Slf4jConfiguration class -org.slf4j.impl.SimpleLoggerFactory org.apache.maven.cli.logging.impl.Slf4jSimpleConfiguration -org.apache.logging.slf4j.Log4jLoggerFactory org.apache.maven.cli.logging.impl.Log4j2Configuration -ch.qos.logback.classic.LoggerContext org.apache.maven.cli.logging.impl.LogbackConfiguration http://git-wip-us.apache.org/repos/asf/maven/blob/58cdef37/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 674ae69..cd5bdaa 100644 --- a/pom.xml +++ b/pom.xml @@ -63,6 +63,8 @@ <jxpathVersion>1.3</jxpathVersion> <aetherVersion>1.0.2.v20150114</aetherVersion> <slf4jVersion>1.7.5</slf4jVersion> + <gossipVersion>1.8</gossipVersion> + <jansiVersion>1.11</jansiVersion> <maven.test.redirectTestOutputToFile>true</maven.test.redirectTestOutputToFile> <!-- Control the name of the distribution and information output by mvn --> <distributionId>apache-maven</distributionId> @@ -266,22 +268,26 @@ <artifactId>plexus-interpolation</artifactId> <version>${plexusInterpolationVersion}</version> </dependency> + <!-- Logging --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>${slf4jVersion}</version> </dependency> <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-simple</artifactId> - <version>${slf4jVersion}</version> - <optional>true</optional> + <groupId>org.sonatype.gossip</groupId> + <artifactId>gossip-slf4j</artifactId> + <version>${gossipVersion}</version> + </dependency> + <dependency> + <groupId>org.sonatype.gossip</groupId> + <artifactId>gossip-extra</artifactId> + <version>${gossipVersion}</version> </dependency> <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - <version>1.0.7</version> - <optional>true</optional> + <groupId>org.fusesource.jansi</groupId> + <artifactId>jansi</artifactId> + <version>${jansiVersion}</version> </dependency> <!-- Wagon --> <dependency>