Extra logging detail if file is empty

This commit is contained in:
Dave Syer 2015-07-06 16:47:44 +01:00
parent e307fe3137
commit 067c7a295c
1 changed files with 8 additions and 2 deletions

View File

@ -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)) {