parent
eae9682117
commit
20c1c617ef
|
@ -192,13 +192,18 @@ public class LoggingApplicationListener implements GenericApplicationListener {
|
|||
}
|
||||
if (System.getProperty(EXCEPTION_CONVERSION_WORD) == null) {
|
||||
System.setProperty(EXCEPTION_CONVERSION_WORD,
|
||||
environment.getProperty("logging.exception-conversion-word", "%rEx"));
|
||||
getExceptionConversionWord(environment));
|
||||
}
|
||||
initializeEarlyLoggingLevel(environment);
|
||||
initializeSystem(environment, this.loggingSystem);
|
||||
initializeFinalLoggingLevels(environment, this.loggingSystem);
|
||||
}
|
||||
|
||||
private String getExceptionConversionWord(ConfigurableEnvironment environment) {
|
||||
RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(environment, "logging.");
|
||||
return resolver.getProperty("exception-conversion-word", "%rEx");
|
||||
}
|
||||
|
||||
private void initializeEarlyLoggingLevel(ConfigurableEnvironment environment) {
|
||||
if (this.parseArgs && this.springBootLogging == null) {
|
||||
if (environment.containsProperty("debug")) {
|
||||
|
|
|
@ -29,6 +29,13 @@
|
|||
"description": "Location of the logging configuration file.",
|
||||
"sourceType": "org.springframework.boot.logging.LoggingApplicationListener"
|
||||
},
|
||||
{
|
||||
"name": "logging.exception-conversion-word",
|
||||
"type": "java.lang.String",
|
||||
"description": "Conversion word used when logging exceptions.",
|
||||
"defaultValue": "%rEx",
|
||||
"sourceType": "org.springframework.boot.logging.LoggingApplicationListener"
|
||||
},
|
||||
{
|
||||
"name": "logging.file",
|
||||
"type": "java.lang.String",
|
||||
|
|
|
@ -332,7 +332,7 @@ public class LoggingApplicationListenerTests {
|
|||
@Test
|
||||
public void overrideExceptionConversionWord() throws Exception {
|
||||
EnvironmentTestUtils.addEnvironment(this.context,
|
||||
"logging.exception-conversion-word:%ex");
|
||||
"logging.exceptionConversionWord:%ex");
|
||||
this.initializer.initialize(this.context.getEnvironment(),
|
||||
this.context.getClassLoader());
|
||||
this.outputCapture.expect(containsString("Hello world"));
|
||||
|
|
Loading…
Reference in New Issue