|
|
@ -27,6 +27,7 @@ import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Properties;
|
|
|
|
import java.util.Properties;
|
|
|
|
import java.util.Set;
|
|
|
|
import java.util.Set;
|
|
|
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.logging.Log;
|
|
|
|
import org.apache.commons.logging.Log;
|
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
@ -666,19 +667,26 @@ public class SpringApplication {
|
|
|
|
protected void logStartupProfileInfo(ConfigurableApplicationContext context) {
|
|
|
|
protected void logStartupProfileInfo(ConfigurableApplicationContext context) {
|
|
|
|
Log log = getApplicationLog();
|
|
|
|
Log log = getApplicationLog();
|
|
|
|
if (log.isInfoEnabled()) {
|
|
|
|
if (log.isInfoEnabled()) {
|
|
|
|
String[] activeProfiles = context.getEnvironment().getActiveProfiles();
|
|
|
|
List<String> activeProfiles = quoteProfiles(context.getEnvironment().getActiveProfiles());
|
|
|
|
if (ObjectUtils.isEmpty(activeProfiles)) {
|
|
|
|
if (ObjectUtils.isEmpty(activeProfiles)) {
|
|
|
|
String[] defaultProfiles = context.getEnvironment().getDefaultProfiles();
|
|
|
|
List<String> defaultProfiles = quoteProfiles(context.getEnvironment().getDefaultProfiles());
|
|
|
|
log.info("No active profile set, falling back to default profiles: "
|
|
|
|
String message = String.format("%s default %s: ", defaultProfiles.size(),
|
|
|
|
+ StringUtils.arrayToCommaDelimitedString(defaultProfiles));
|
|
|
|
(defaultProfiles.size() <= 1) ? "profile" : "profiles");
|
|
|
|
|
|
|
|
log.info("No active profile set, falling back to " + message
|
|
|
|
|
|
|
|
+ StringUtils.collectionToDelimitedString(defaultProfiles, ", "));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
log.info("The following profiles are active: "
|
|
|
|
String message = (activeProfiles.size() == 1) ? "1 profile is active: "
|
|
|
|
+ StringUtils.arrayToCommaDelimitedString(activeProfiles));
|
|
|
|
: activeProfiles.size() + " profiles are active: ";
|
|
|
|
|
|
|
|
log.info("The following " + message + StringUtils.collectionToDelimitedString(activeProfiles, ", "));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private List<String> quoteProfiles(String[] profiles) {
|
|
|
|
|
|
|
|
return Arrays.stream(profiles).map((profile) -> "\"" + profile + "\"").collect(Collectors.toList());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Returns the {@link Log} for the application. By default will be deduced.
|
|
|
|
* Returns the {@link Log} for the application. By default will be deduced.
|
|
|
|
* @return the application log
|
|
|
|
* @return the application log
|
|
|
|