From 2c563004d5fd76d06df6bf8f6eb858e33d0f30cd Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Thu, 23 Oct 2025 11:02:57 +0100 Subject: [PATCH] Clean up logging system properties to avoid test pollution See gh-47424 --- .../boot/logging/log4j2/SpringProfileArbiterTests.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/SpringProfileArbiterTests.java b/core/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/SpringProfileArbiterTests.java index 90b0a6f4c3f..308f10bad64 100644 --- a/core/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/SpringProfileArbiterTests.java +++ b/core/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/SpringProfileArbiterTests.java @@ -32,6 +32,7 @@ import org.junit.jupiter.api.TestInfo; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.boot.logging.LoggingInitializationContext; +import org.springframework.boot.logging.LoggingSystemProperty; import org.springframework.boot.testsupport.classpath.ClassPathExclusions; import org.springframework.boot.testsupport.classpath.resources.WithResource; import org.springframework.boot.testsupport.logging.ConfigureClasspathToPreferLog4j2; @@ -75,6 +76,9 @@ class SpringProfileArbiterTests { void cleanUp() { this.loggingSystem.cleanUp(); cleanUpPropertySources(); + for (LoggingSystemProperty property : LoggingSystemProperty.values()) { + System.getProperties().remove(property.getEnvironmentVariableName()); + } } @SuppressWarnings("unchecked")