diff --git a/spring-boot/src/main/java/org/springframework/boot/env/PropertySourcesLoader.java b/spring-boot/src/main/java/org/springframework/boot/env/PropertySourcesLoader.java index 44e783429e..4aa2a34c0b 100644 --- a/spring-boot/src/main/java/org/springframework/boot/env/PropertySourcesLoader.java +++ b/spring-boot/src/main/java/org/springframework/boot/env/PropertySourcesLoader.java @@ -22,6 +22,8 @@ import java.util.HashSet; import java.util.List; import java.util.Set; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.springframework.core.env.MutablePropertySources; import org.springframework.core.env.PropertySource; import org.springframework.core.io.Resource; @@ -37,6 +39,8 @@ import org.springframework.util.StringUtils; */ public class PropertySourcesLoader { + private static Log logger = LogFactory.getLog(PropertySourcesLoader.class); + private final MutablePropertySources propertySources; private final List loaders; @@ -164,6 +168,7 @@ public class PropertySourcesLoader { EnumerableCompositePropertySource group = getGeneric(basename); group.add(source); + logger.info("Adding PropertySource: " + source + " in group: " + basename); if (this.propertySources.contains(group.getName())) { this.propertySources.replace(group.getName(), group); } 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 4f4865e317..3298ff9b94 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,7 +1,7 @@ - + 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 index 5be82ccb4c..266ac62b2e 100644 --- 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 @@ -1,31 +1,4 @@ - - - - - - - - - ${CONSOLE_LOG_PATTERN} - - - - - org.springframework.boot - - - - - - - - - - - - - - - - + + + diff --git a/spring-boot/src/main/resources/org/springframework/boot/logging/logback/basic.xml b/spring-boot/src/main/resources/org/springframework/boot/logging/logback/basic.xml new file mode 100644 index 0000000000..5be82ccb4c --- /dev/null +++ b/spring-boot/src/main/resources/org/springframework/boot/logging/logback/basic.xml @@ -0,0 +1,31 @@ + + + + + + + + + + ${CONSOLE_LOG_PATTERN} + + + + + org.springframework.boot + + + + + + + + + + + + + + + + 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 87c0b5108e..537ff02cb3 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 @@ -24,12 +24,18 @@ import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; +import org.slf4j.ILoggerFactory; +import org.slf4j.impl.StaticLoggerBinder; import org.springframework.boot.logging.LogLevel; import org.springframework.boot.test.OutputCapture; import org.springframework.util.StringUtils; +import ch.qos.logback.classic.Logger; +import ch.qos.logback.classic.LoggerContext; + import static org.hamcrest.Matchers.equalTo; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; @@ -65,6 +71,15 @@ public class LogbackLoggingSystemTests { System.clearProperty("PID"); } + @Test + public void testBasicConfigLocation() throws Exception { + this.loggingSystem.beforeInitialize(); + ILoggerFactory factory = StaticLoggerBinder.getSingleton().getLoggerFactory(); + LoggerContext context = (LoggerContext) factory; + Logger root = context.getLogger(Logger.ROOT_LOGGER_NAME); + assertNotNull(root.getAppender("CONSOLE")); + } + @Test public void testNonDefaultConfigLocation() throws Exception { this.loggingSystem.beforeInitialize();