- 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/8fa21b6e Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/8fa21b6e Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/8fa21b6e Branch: refs/heads/slf4j-logback Commit: 8fa21b6ea85c0c8091a96a22b4ea102edcd0a988 Parents: 9f8eabc Author: Jason van Zyl <jvan...@apache.org> Authored: Sat Dec 1 15:04:29 2012 -0800 Committer: Arnaud HeÌritier <aherit...@apache.org> Committed: Tue Jul 16 00:17:47 2013 +0200 ---------------------------------------------------------------------- apache-maven/pom.xml | 15 ++++++++++++--- apache-maven/src/conf/logging/logback-colour.xml | 17 +++++++++++++++++ apache-maven/src/conf/logging/logback.xml | 11 +++++++++++ pom.xml | 18 ++++++++++++++---- 4 files changed, 54 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven/blob/8fa21b6e/apache-maven/pom.xml ---------------------------------------------------------------------- diff --git a/apache-maven/pom.xml b/apache-maven/pom.xml index 084d30d..f7d83cd 100644 --- a/apache-maven/pom.xml +++ b/apache-maven/pom.xml @@ -84,9 +84,18 @@ <artifactId>aether-connector-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/8fa21b6e/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..7642816 --- /dev/null +++ b/apache-maven/src/conf/logging/logback-colour.xml @@ -0,0 +1,17 @@ +<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/8fa21b6e/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..5ed60d0 --- /dev/null +++ b/apache-maven/src/conf/logging/logback.xml @@ -0,0 +1,11 @@ +<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/8fa21b6e/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 15bdee0..330912b 100644 --- a/pom.xml +++ b/pom.xml @@ -59,7 +59,9 @@ <modelloVersion>1.7</modelloVersion> <jxpathVersion>1.3</jxpathVersion> <aetherVersion>0.9.0.M2</aetherVersion> - <slf4jVersion>1.7.4</slf4jVersion> + <slf4jVersion>1.7.5</slf4jVersion> + <logbackVersion>1.0.13</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> @@ -230,13 +232,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>