Commit 616d230e authored by Phillip Webb's avatar Phillip Webb

Merge pull request #7639 from chaodhib/patch-1

* pr/7639:
  Broaden LoggingApplicationListener ignores
parents f36ed673 2ea4d4b1
...@@ -314,12 +314,7 @@ public class LoggingApplicationListener implements GenericApplicationListener { ...@@ -314,12 +314,7 @@ public class LoggingApplicationListener implements GenericApplicationListener {
} }
private boolean ignoreLogConfig(String logConfig) { private boolean ignoreLogConfig(String logConfig) {
return !StringUtils.hasLength(logConfig) return !StringUtils.hasLength(logConfig) || logConfig.startsWith("-D");
|| isDefaultAzureLoggingConfig(logConfig);
}
private boolean isDefaultAzureLoggingConfig(String candidate) {
return candidate.startsWith("-Djava.util.logging.config.file=");
} }
private void initializeFinalLoggingLevels(ConfigurableEnvironment environment, private void initializeFinalLoggingLevels(ConfigurableEnvironment environment,
......
...@@ -162,6 +162,18 @@ public class LoggingApplicationListenerTests { ...@@ -162,6 +162,18 @@ public class LoggingApplicationListenerTests {
assertThat(new File(tmpDir() + "/spring.log").exists()).isFalse(); assertThat(new File(tmpDir() + "/spring.log").exists()).isFalse();
} }
@Test
public void tomcatNopLoggingConfigDoesNotCauseAFailure() throws Exception {
TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context,
"logging.config: -Dnop");
this.initializer.initialize(this.context.getEnvironment(),
this.context.getClassLoader());
this.logger.info("Hello world");
String output = this.outputCapture.toString().trim();
assertThat(output).contains("Hello world").doesNotContain("???");
assertThat(new File(tmpDir() + "/spring.log").exists()).isFalse();
}
@Test @Test
public void overrideConfigBroken() throws Exception { public void overrideConfigBroken() throws Exception {
TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context, TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment