diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/AbstractLoggingSystem.java b/spring-boot/src/main/java/org/springframework/boot/logging/AbstractLoggingSystem.java
index 23a37292a8..ef3270b989 100644
--- a/spring-boot/src/main/java/org/springframework/boot/logging/AbstractLoggingSystem.java
+++ b/spring-boot/src/main/java/org/springframework/boot/logging/AbstractLoggingSystem.java
@@ -54,10 +54,12 @@ public abstract class AbstractLoggingSystem extends LoggingSystem {
return;
}
}
+ // Fallback to the non-prefixed value
+ initialize(getPackagedConfigFile(this.paths[this.paths.length - 1]));
}
protected void initializeWithSensibleDefaults() {
- initialize(getPackagedConfigFile(this.paths[this.paths.length - 1]));
+ initialize(getPackagedConfigFile("basic-" + this.paths[this.paths.length - 1]));
}
protected final String getPackagedConfigFile(String fileName) {
diff --git a/spring-boot/src/main/resources/org/springframework/boot/logging/java/basic-logging.properties b/spring-boot/src/main/resources/org/springframework/boot/logging/java/basic-logging.properties
new file mode 100644
index 0000000000..ae39617ab9
--- /dev/null
+++ b/spring-boot/src/main/resources/org/springframework/boot/logging/java/basic-logging.properties
@@ -0,0 +1,11 @@
+handlers = java.util.logging.ConsoleHandler
+.level = INFO
+
+java.util.logging.ConsoleHandler.formatter = org.springframework.boot.logging.java.SimpleFormatter
+java.util.logging.ConsoleHandler.level = ALL
+
+org.hibernate.validator.internal.util.Version.level = WARNING
+org.apache.coyote.http11.Http11NioProtocol.level = WARNING
+org.crsh.plugin.level = WARNING
+org.apache.tomcat.util.net.NioSelectorPool.level = WARNING
+org.apache.catalina.startup.DigesterFactory.level = SEVERE
diff --git a/spring-boot/src/main/resources/org/springframework/boot/logging/log4j/basic-log4j.properties b/spring-boot/src/main/resources/org/springframework/boot/logging/log4j/basic-log4j.properties
new file mode 100644
index 0000000000..3e57f86d21
--- /dev/null
+++ b/spring-boot/src/main/resources/org/springframework/boot/logging/log4j/basic-log4j.properties
@@ -0,0 +1,15 @@
+log4j.rootCategory=INFO, CONSOLE, FILE
+
+PID=????
+LOG_PATTERN=[%d{yyyy-MM-dd HH:mm:ss.SSS}] boot%X{context} - ${PID} %5p [%t] --- %c{1}: %m%n
+
+# CONSOLE is set to be a ConsoleAppender using a PatternLayout.
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=${LOG_PATTERN}
+
+log4j.category.org.hibernate.validator.internal.util.Version=WARN
+log4j.category.org.apache.coyote.http11.Http11NioProtocol=WARN
+log4j.category.org.crsh.plugin=WARN
+log4j.category.org.apache.tomcat.util.net.NioSelectorPool=WARN
+log4j.category.org.apache.catalina.startup.DigesterFactory=ERROR
diff --git a/spring-boot/src/main/resources/org/springframework/boot/logging/logback/base.xml b/spring-boot/src/main/resources/org/springframework/boot/logging/logback/base.xml
index db049948ce..8a24ece0e1 100644
--- a/spring-boot/src/main/resources/org/springframework/boot/logging/logback/base.xml
+++ b/spring-boot/src/main/resources/org/springframework/boot/logging/logback/base.xml
@@ -1,17 +1,10 @@
+
+
+
-
-
-
-
-
-
-
- ${CONSOLE_LOG_PATTERN}
-
-
@@ -28,22 +21,9 @@
-
- org.springframework.boot
-
-
-
-
-
-
-
-
-
-
-
diff --git a/spring-boot/src/main/resources/org/springframework/boot/logging/logback/basic-logback.xml b/spring-boot/src/main/resources/org/springframework/boot/logging/logback/basic-logback.xml
new file mode 100644
index 0000000000..0ce671c213
--- /dev/null
+++ b/spring-boot/src/main/resources/org/springframework/boot/logging/logback/basic-logback.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+ ${CONSOLE_LOG_PATTERN}
+
+
+
+
+ org.springframework.boot
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-boot/src/test/java/org/springframework/boot/logging/LoggingApplicationListenerTests.java b/spring-boot/src/test/java/org/springframework/boot/logging/LoggingApplicationListenerTests.java
index f00a9c634f..43f1babb82 100644
--- a/spring-boot/src/test/java/org/springframework/boot/logging/LoggingApplicationListenerTests.java
+++ b/spring-boot/src/test/java/org/springframework/boot/logging/LoggingApplicationListenerTests.java
@@ -72,6 +72,7 @@ public class LoggingApplicationListenerTests {
this.initializer.onApplicationEvent(new ApplicationStartedEvent(
new SpringApplication(), NO_ARGS));
new File("target/foo.log").delete();
+ new File("/tmp/spring.log").delete();
}
@After
@@ -85,13 +86,14 @@ public class LoggingApplicationListenerTests {
}
@Test
- public void testDefaultConfigLocation() {
+ public void testBaseConfigLocation() {
this.initializer.initialize(this.context.getEnvironment(),
this.context.getClassLoader());
this.logger.info("Hello world");
String output = this.outputCapture.toString().trim();
assertTrue("Wrong output:\n" + output, output.contains("Hello world"));
assertFalse("Wrong output:\n" + output, output.contains("???"));
+ assertTrue(new File("/tmp/spring.log").exists());
}
@Test
diff --git a/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java b/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java
index 6293ccd365..d946ed842c 100644
--- a/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java
+++ b/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java
@@ -16,6 +16,8 @@
package org.springframework.boot.logging.logback;
+import java.io.File;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.impl.SLF4JLogFactory;
import org.junit.After;
@@ -27,6 +29,7 @@ import org.springframework.boot.test.OutputCapture;
import org.springframework.util.StringUtils;
import static org.hamcrest.Matchers.equalTo;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
@@ -48,6 +51,7 @@ public class LogbackLoggingSystemTests {
@Before
public void setup() {
this.logger = new SLF4JLogFactory().getInstance(getClass().getName());
+ new File("/tmp/spring.log").delete();
}
@After
@@ -65,6 +69,7 @@ public class LogbackLoggingSystemTests {
String output = this.output.toString().trim();
assertTrue("Wrong output:\n" + output, output.contains("Hello world"));
assertTrue("Wrong output:\n" + output, output.contains("/tmp/spring.log"));
+ assertFalse(new File("/tmp/spring.log").exists());
}
@Test(expected = IllegalStateException.class)