|
22 | 22 | import java.util.Map; |
23 | 23 | import java.util.Properties; |
24 | 24 |
|
25 | | -import org.apache.commons.logging.Log; |
26 | | -import org.apache.commons.logging.LogFactory; |
27 | | - |
28 | 25 | import org.springframework.boot.SpringApplication; |
29 | 26 | import org.springframework.boot.context.config.ConfigFileApplicationListener; |
| 27 | +import org.springframework.boot.context.event.ApplicationPreparedEvent; |
30 | 28 | import org.springframework.boot.env.EnvironmentPostProcessor; |
31 | 29 | import org.springframework.boot.json.JsonParser; |
32 | 30 | import org.springframework.boot.json.JsonParserFactory; |
| 31 | +import org.springframework.boot.logging.DeferredLog; |
| 32 | +import org.springframework.context.ApplicationListener; |
33 | 33 | import org.springframework.core.Ordered; |
34 | 34 | import org.springframework.core.env.CommandLinePropertySource; |
35 | 35 | import org.springframework.core.env.ConfigurableEnvironment; |
|
89 | 89 | * @author Andy Wilkinson |
90 | 90 | * @since 1.3.0 |
91 | 91 | */ |
92 | | -public class CloudFoundryVcapEnvironmentPostProcessor implements EnvironmentPostProcessor, Ordered { |
| 92 | +public class CloudFoundryVcapEnvironmentPostProcessor |
| 93 | + implements EnvironmentPostProcessor, Ordered, ApplicationListener<ApplicationPreparedEvent> { |
93 | 94 |
|
94 | | - private static final Log logger = LogFactory.getLog(CloudFoundryVcapEnvironmentPostProcessor.class); |
| 95 | + private static final DeferredLog logger = new DeferredLog(); |
95 | 96 |
|
96 | 97 | private static final String VCAP_APPLICATION = "VCAP_APPLICATION"; |
97 | 98 |
|
@@ -127,6 +128,11 @@ public void postProcessEnvironment(ConfigurableEnvironment environment, SpringAp |
127 | 128 | } |
128 | 129 | } |
129 | 130 |
|
| 131 | + @Override |
| 132 | + public void onApplicationEvent(ApplicationPreparedEvent event) { |
| 133 | + logger.switchTo(CloudFoundryVcapEnvironmentPostProcessor.class); |
| 134 | + } |
| 135 | + |
130 | 136 | private void addWithPrefix(Properties properties, Properties other, String prefix) { |
131 | 137 | for (String key : other.stringPropertyNames()) { |
132 | 138 | String prefixed = prefix + key; |
|
0 commit comments