Skip to content

Commit 295dc65

Browse files
committed
Fix LoggingSystem tests following System property changes
1 parent 7787321 commit 295dc65

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,17 +120,17 @@ public class LoggingApplicationListener implements GenericApplicationListener {
120120
public static final String LOG_PATH = "LOG_PATH";
121121

122122
/**
123-
* The name of the System property that contains the console log pattern
123+
* The name of the System property that contains the console log pattern.
124124
*/
125125
public static final String CONSOLE_LOG_PATTERN = "CONSOLE_LOG_PATTERN";
126126

127127
/**
128-
* The name of the System property that contains the file log pattern
128+
* The name of the System property that contains the file log pattern.
129129
*/
130130
public static final String FILE_LOG_PATTERN = "FILE_LOG_PATTERN";
131131

132132
/**
133-
* The name of the System property that contains the log level pattern
133+
* The name of the System property that contains the log level pattern.
134134
*/
135135
public static final String LOG_LEVEL_PATTERN = "LOG_LEVEL_PATTERN";
136136

spring-boot/src/test/java/org/springframework/boot/logging/AbstractLoggingSystemTests.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2014 the original author or authors.
2+
* Copyright 2012-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -62,7 +62,9 @@ protected final String[] getSpringConfigLocations(AbstractLoggingSystem system)
6262
}
6363

6464
protected final LogFile getLogFile(String file, String path) {
65-
return new LogFile(file, path);
65+
LogFile logFile = new LogFile(file, path);
66+
logFile.applyToSystemProperties();
67+
return logFile;
6668
}
6769

6870
protected final String tmpDir() {

spring-boot/src/test/java/org/springframework/boot/logging/LoggingApplicationListenerTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ public void closingChildContextDoesNotCleanUpLoggingSystem() {
426426
@Test
427427
public void systemPropertiesAreSetForLoggingConfiguration() {
428428
EnvironmentTestUtils.addEnvironment(this.context,
429-
"logging.exception-conversion-word=conversion", "logging.file=file",
429+
"logging.exception-conversion-word=conversion", "logging.file=target/log",
430430
"logging.path=path", "logging.pattern.console=console",
431431
"logging.pattern.file=file", "logging.pattern.level=level");
432432
this.initializer.initialize(this.context.getEnvironment(),
@@ -435,7 +435,7 @@ public void systemPropertiesAreSetForLoggingConfiguration() {
435435
assertThat(System.getProperty("FILE_LOG_PATTERN"), is(equalTo("file")));
436436
assertThat(System.getProperty("LOG_EXCEPTION_CONVERSION_WORD"),
437437
is(equalTo("conversion")));
438-
assertThat(System.getProperty("LOG_FILE"), is(equalTo("file")));
438+
assertThat(System.getProperty("LOG_FILE"), is(equalTo("target/log")));
439439
assertThat(System.getProperty("LOG_LEVEL_PATTERN"), is(equalTo("level")));
440440
assertThat(System.getProperty("LOG_PATH"), is(equalTo("path")));
441441
assertThat(System.getProperty("PID"), is(not(nullValue())));

0 commit comments

Comments
 (0)