From 95373af3747d67af09acec5c396e9673f7c94b53 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Fri, 12 Jul 2013 11:15:06 -0700 Subject: [PATCH] Use logback as default logging implementation Issue: #53278727 --- .../SpringCompilerAutoConfiguration.java | 23 +++++++++-------- .../cli/SampleIntegrationTests.java | 5 ++++ spring-starters/pom.xml | 3 ++- .../spring-starter-logging/pom.xml | 25 +++++++++++++++++++ spring-starters/spring-starter/pom.xml | 5 ++++ .../batch/SampleBatchApplicationTests.java | 9 ++++--- 6 files changed, 55 insertions(+), 15 deletions(-) create mode 100644 spring-starters/spring-starter-logging/pom.xml diff --git a/spring-cli/src/main/java/org/springframework/cli/compiler/autoconfigure/SpringCompilerAutoConfiguration.java b/spring-cli/src/main/java/org/springframework/cli/compiler/autoconfigure/SpringCompilerAutoConfiguration.java index 416aa84f8aa..5268596283f 100644 --- a/spring-cli/src/main/java/org/springframework/cli/compiler/autoconfigure/SpringCompilerAutoConfiguration.java +++ b/spring-cli/src/main/java/org/springframework/cli/compiler/autoconfigure/SpringCompilerAutoConfiguration.java @@ -42,17 +42,18 @@ public class SpringCompilerAutoConfiguration extends CompilerAutoConfiguration { "org.springframework.bootstrap.SpringApplication").add( "org.springframework.zero", "spring-autoconfigure", "0.5.0.BUILD-SNAPSHOT"); - dependencies.ifAnyResourcesPresent("logback.xml").add("ch.qos.logback", - "logback-classic", "1.0.7"); - dependencies.ifNotAdded("cg.qos.logback", "logback-classic") - .ifAnyResourcesPresent("log4j.properties", "log4j.xml") - .add("org.slf4j", "slf4j-log4j12", "1.7.5") - .add("log4j", "log4j", "1.2.16") - .add("org.slf4j", "jcl-over-slf4j", "1.7.5"); - dependencies.ifNotAdded("ch.qos.logback", "logback-classic") - .ifNotAdded("org.slf4j", "slf4j-log4j12") - .add("org.slf4j", "slf4j-jdk14", "1.7.5") - .add("org.slf4j", "jcl-over-slf4j", "1.7.5"); + // FIXME currently broken on CI + decide how relates to logging + // dependencies.ifAnyResourcesPresent("logback.xml").add("ch.qos.logback", + // "logback-classic", "1.0.7"); + // dependencies.ifNotAdded("cg.qos.logback", "logback-classic") + // .ifAnyResourcesPresent("log4j.properties", "log4j.xml") + // .add("org.slf4j", "slf4j-log4j12", "1.7.5") + // .add("log4j", "log4j", "1.2.16") + // .add("org.slf4j", "jcl-over-slf4j", "1.7.5"); + // dependencies.ifNotAdded("ch.qos.logback", "logback-classic") + // .ifNotAdded("org.slf4j", "slf4j-log4j12") + // .add("org.slf4j", "slf4j-jdk14", "1.7.5") + // .add("org.slf4j", "jcl-over-slf4j", "1.7.5"); // FIXME get the version } diff --git a/spring-cli/src/test/java/org/springframework/cli/SampleIntegrationTests.java b/spring-cli/src/test/java/org/springframework/cli/SampleIntegrationTests.java index b5a0b62d5c5..c028c8435a7 100644 --- a/spring-cli/src/test/java/org/springframework/cli/SampleIntegrationTests.java +++ b/spring-cli/src/test/java/org/springframework/cli/SampleIntegrationTests.java @@ -54,16 +54,21 @@ public class SampleIntegrationTests { private ByteArrayOutputStream output; + private PrintStream savedErr; + @Before public void init() { this.savedOutput = System.out; + this.savedErr = System.err; this.output = new ByteArrayOutputStream(); System.setOut(new PrintStream(this.output)); + System.setErr(new PrintStream(this.output)); } @After public void clear() { System.setOut(this.savedOutput); + System.setErr(this.savedErr); } private String getOutput() { diff --git a/spring-starters/pom.xml b/spring-starters/pom.xml index ff8e8e71777..20fdbeb0c46 100644 --- a/spring-starters/pom.xml +++ b/spring-starters/pom.xml @@ -16,8 +16,9 @@ spring-starter spring-starter-actuator spring-starter-batch - spring-starter-integration spring-starter-data-jpa + spring-starter-integration + spring-starter-logging spring-starter-parent spring-starter-security spring-starter-web diff --git a/spring-starters/spring-starter-logging/pom.xml b/spring-starters/spring-starter-logging/pom.xml new file mode 100644 index 00000000000..b189556b62e --- /dev/null +++ b/spring-starters/spring-starter-logging/pom.xml @@ -0,0 +1,25 @@ + + + 4.0.0 + + org.springframework.zero + spring-starters + 0.5.0.BUILD-SNAPSHOT + + spring-starter-logging + jar + + ${basedir}/../.. + + + + org.slf4j + jcl-over-slf4j + + + ch.qos.logback + logback-classic + + + diff --git a/spring-starters/spring-starter/pom.xml b/spring-starters/spring-starter/pom.xml index c2dbc1e241e..14ca37d1d75 100644 --- a/spring-starters/spring-starter/pom.xml +++ b/spring-starters/spring-starter/pom.xml @@ -13,6 +13,11 @@ ${basedir}/../.. + + ${project.groupId} + spring-starter-logging + ${project.version} + ${project.groupId} spring-bootstrap diff --git a/spring-zero-samples/spring-zero-sample-batch/src/test/java/org/springframework/zero/sample/batch/SampleBatchApplicationTests.java b/spring-zero-samples/spring-zero-sample-batch/src/test/java/org/springframework/zero/sample/batch/SampleBatchApplicationTests.java index 873fbfbf672..acd66cdb0a8 100644 --- a/spring-zero-samples/spring-zero-sample-batch/src/test/java/org/springframework/zero/sample/batch/SampleBatchApplicationTests.java +++ b/spring-zero-samples/spring-zero-sample-batch/src/test/java/org/springframework/zero/sample/batch/SampleBatchApplicationTests.java @@ -30,19 +30,22 @@ import static org.junit.Assert.assertTrue; public class SampleBatchApplicationTests { private PrintStream savedOutput; + private PrintStream savedErr; private ByteArrayOutputStream output; @Before public void init() { - this.savedOutput = System.err; + this.savedOutput = System.out; + this.savedErr = System.err; this.output = new ByteArrayOutputStream(); - // jdk logging goes to syserr by default + System.setOut(new PrintStream(this.output)); System.setErr(new PrintStream(this.output)); } @After public void after() { - System.setErr(this.savedOutput); + System.setOut(this.savedOutput); + System.setErr(this.savedErr); } private String getOutput() {