From 067c7a295cb0c4c251cc3598ac97fd72cb17fa9a Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Mon, 6 Jul 2015 16:47:44 +0100 Subject: [PATCH] Extra logging detail if file is empty --- .../context/config/ConfigFileApplicationListener.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java b/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java index d2f987d30b5..87e338f720a 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java @@ -384,20 +384,26 @@ public class ConfigFileApplicationListener implements String profile) throws IOException { Resource resource = this.resourceLoader.getResource(location); PropertySource propertySource = null; + StringBuilder msg = new StringBuilder(); if (resource != null && resource.exists()) { String name = "applicationConfig: [" + location + "]"; String group = "applicationConfig: [" + identifier + "]"; propertySource = this.propertiesLoader.load(resource, group, name, profile); if (propertySource != null) { + msg.append("Loaded "); maybeActivateProfiles(propertySource .getProperty(ACTIVE_PROFILES_PROPERTY)); addIncludeProfiles(propertySource .getProperty(INCLUDE_PROFILES_PROPERTY)); } + else { + msg.append("Skipped (empty) "); + } + } + else { + msg.append("Skipped "); } - StringBuilder msg = new StringBuilder(); - msg.append(propertySource == null ? "Skipped " : "Loaded "); msg.append("config file "); msg.append("'").append(location).append("'"); if (StringUtils.hasLength(profile)) {