Skip to content

Commit 2c56300

Browse files
committed
Clean up logging system properties to avoid test pollution
See gh-47424
1 parent a120ed4 commit 2c56300

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

core/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/SpringProfileArbiterTests.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import org.junit.jupiter.api.extension.ExtendWith;
3333

3434
import org.springframework.boot.logging.LoggingInitializationContext;
35+
import org.springframework.boot.logging.LoggingSystemProperty;
3536
import org.springframework.boot.testsupport.classpath.ClassPathExclusions;
3637
import org.springframework.boot.testsupport.classpath.resources.WithResource;
3738
import org.springframework.boot.testsupport.logging.ConfigureClasspathToPreferLog4j2;
@@ -75,6 +76,9 @@ void setup(CapturedOutput output, TestInfo testInfo) {
7576
void cleanUp() {
7677
this.loggingSystem.cleanUp();
7778
cleanUpPropertySources();
79+
for (LoggingSystemProperty property : LoggingSystemProperty.values()) {
80+
System.getProperties().remove(property.getEnvironmentVariableName());
81+
}
7882
}
7983

8084
@SuppressWarnings("unchecked")

0 commit comments

Comments
 (0)