Repository: maven Updated Branches: refs/heads/slf4j-logback [created] e73fc36dd
- example of using Logback being integrated with the color console turned on - Maven with Logback now passes all the ITs, needed to correct the warning string and set the appropriate log levels - adding two basic logback configurations. one for non-colour which is the default, and one for colour logging that serves as an example if someone wants to turn it on and customize it. Project: http://git-wip-us.apache.org/repos/asf/maven/repo Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/759c5ce3 Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/759c5ce3 Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/759c5ce3 Branch: refs/heads/slf4j-logback Commit: 759c5ce37757262af90286cb6303556772f3993d Parents: bb52d85 Author: Jason van Zyl <jvan...@apache.org> Authored: Sat Dec 1 15:04:29 2012 -0800 Committer: Arnaud HeÌritier <aherit...@apache.org> Committed: Thu Jan 7 11:51:45 2016 +0100 ---------------------------------------------------------------------- apache-maven/pom.xml | 15 ++++++-- .../src/conf/logging/logback-colour.xml | 36 ++++++++++++++++++++ apache-maven/src/conf/logging/logback.xml | 30 ++++++++++++++++ pom.xml | 16 +++++++-- 4 files changed, 91 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven/blob/759c5ce3/apache-maven/pom.xml ---------------------------------------------------------------------- diff --git a/apache-maven/pom.xml b/apache-maven/pom.xml index 3958883..4d8fa65 100644 --- a/apache-maven/pom.xml +++ b/apache-maven/pom.xml @@ -88,9 +88,18 @@ <artifactId>aether-transport-wagon</artifactId> </dependency> <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-simple</artifactId> - </dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-core</artifactId> + </dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + </dependency> + <dependency> + <groupId>org.fusesource.jansi</groupId> + <artifactId>jansi</artifactId> + <scope>runtime</scope> + </dependency> </dependencies> <build> http://git-wip-us.apache.org/repos/asf/maven/blob/759c5ce3/apache-maven/src/conf/logging/logback-colour.xml ---------------------------------------------------------------------- diff --git a/apache-maven/src/conf/logging/logback-colour.xml b/apache-maven/src/conf/logging/logback-colour.xml new file mode 100644 index 0000000..a3298a7 --- /dev/null +++ b/apache-maven/src/conf/logging/logback-colour.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + ~ 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. + --> +<configuration> + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <withJansi>true</withJansi> + <encoder> + <!-- + | + | If you wish to customize the coloured output you can refer + | to http://logback.qos.ch/manual/layouts.html#coloring + | + --> + <pattern>%highlight([%replace(%level){'WARN','WARNING'}]) %msg %n</pattern> + </encoder> + </appender> + <root level="INFO"> + <appender-ref ref="STDOUT" /> + </root> +</configuration> http://git-wip-us.apache.org/repos/asf/maven/blob/759c5ce3/apache-maven/src/conf/logging/logback.xml ---------------------------------------------------------------------- diff --git a/apache-maven/src/conf/logging/logback.xml b/apache-maven/src/conf/logging/logback.xml new file mode 100644 index 0000000..fa8a43e --- /dev/null +++ b/apache-maven/src/conf/logging/logback.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + ~ 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. + --> +<configuration> + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <withJansi>true</withJansi> + <encoder> + <pattern>[%replace(%level){'WARN','WARNING'}] %msg%n</pattern> + </encoder> + </appender> + <root level="INFO"> + <appender-ref ref="STDOUT" /> + </root> +</configuration> http://git-wip-us.apache.org/repos/asf/maven/blob/759c5ce3/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 7d44da6..f09da65 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> + <logbackVersion>1.1.3</logbackVersion> + <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> @@ -275,13 +277,21 @@ <groupId>org.slf4j</groupId> <artifactId>slf4j-simple</artifactId> <version>${slf4jVersion}</version> - <optional>true</optional> + </dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-core</artifactId> + <version>${logbackVersion}</version> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> - <version>1.0.7</version> - <optional>true</optional> + <version>${logbackVersion}</version> + </dependency> + <dependency> + <groupId>org.fusesource.jansi</groupId> + <artifactId>jansi</artifactId> + <version>${jansiVersion}</version> </dependency> <!-- Wagon --> <dependency>