diff --git a/spring-boot-project/spring-boot-docs/src/docs/antora/modules/reference/pages/features/logging.adoc b/spring-boot-project/spring-boot-docs/src/docs/antora/modules/reference/pages/features/logging.adoc
index 0dba5146f276..412fc2b83c41 100644
--- a/spring-boot-project/spring-boot-docs/src/docs/antora/modules/reference/pages/features/logging.adoc
+++ b/spring-boot-project/spring-boot-docs/src/docs/antora/modules/reference/pages/features/logging.adoc
@@ -712,13 +712,13 @@ The following listing shows three sample profiles:
If you want to refer to properties from your Spring `Environment` within your Log4j2 configuration you can use `spring:` prefixed https://logging.apache.org/log4j/2.x/manual/lookups.html[lookups].
Doing so can be useful if you want to access values from your `application.properties` file in your Log4j2 configuration.
-The following example shows how to set a Log4j2 property named `applicationName` and `applicationGroup` that reads `spring.application.name` and `spring.application.group` from the Spring `Environment`:
+The following example shows how to set Log4j2 properties named `applicationName` and `applicationGroup` that read `spring.application.name` and `spring.application.group` from the Spring `Environment`:
[source,xml]
----
${spring:spring.application.name}
- ${spring:spring.application.property}
+ ${spring:spring.application.group}
----
diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystemProperty.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystemProperty.java
index d651d5684523..c06f803351d7 100644
--- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystemProperty.java
+++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystemProperty.java
@@ -32,6 +32,7 @@ public enum LoggingSystemProperty {
/**
* Logging system property for the application group that should be logged.
+ * @since 3.4.0
*/
APPLICATION_GROUP("APPLICATION_GROUP", "spring.application.group", "logging.include-application-group"),
diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/EnclosedInSquareBracketsConverter.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/EnclosedInSquareBracketsConverter.java
index 907a5d710b25..190e23d869f1 100644
--- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/EnclosedInSquareBracketsConverter.java
+++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/EnclosedInSquareBracketsConverter.java
@@ -29,8 +29,8 @@
import org.apache.logging.log4j.core.pattern.PatternParser;
/**
- * Log4j2 {@link LogEventPatternConverter} used help format optional values that should be
- * shown enclosed in square brackets.
+ * Log4j2 {@link LogEventPatternConverter} used to help format optional values that should
+ * be shown enclosed in square brackets.
*
* @author Phillip Webb
* @since 3.4.0
diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/EnclosedInSquareBracketsConverter.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/EnclosedInSquareBracketsConverter.java
index e90fa5c6f20a..b9474cc364d5 100644
--- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/EnclosedInSquareBracketsConverter.java
+++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/EnclosedInSquareBracketsConverter.java
@@ -22,7 +22,7 @@
import org.springframework.util.StringUtils;
/**
- * Logback {@link CompositeConverter} used help format optional values that should be
+ * Logback {@link CompositeConverter} used to help format optional values that should be
* shown enclosed in square brackets.
*
* @author Phillip Webb
diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/LoggingSystemPropertiesTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/LoggingSystemPropertiesTests.java
index 7b3763799f22..72308c2f98f7 100644
--- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/LoggingSystemPropertiesTests.java
+++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/LoggingSystemPropertiesTests.java
@@ -164,19 +164,19 @@ void legacyLoggedApplicationNameWhenHasApplicationName() {
}
@Test
- void loggedApplicationGroupWhenHasApplicationGroup() {
+ void applicationGroupWhenHasApplicationGroup() {
new LoggingSystemProperties(new MockEnvironment().withProperty("spring.application.group", "test")).apply(null);
assertThat(getSystemProperty(LoggingSystemProperty.APPLICATION_GROUP)).isEqualTo("test");
}
@Test
- void loggedApplicationGroupWhenHasNoApplicationGroup() {
+ void applicationGroupWhenHasNoApplicationGroup() {
new LoggingSystemProperties(new MockEnvironment()).apply(null);
assertThat(getSystemProperty(LoggingSystemProperty.APPLICATION_GROUP)).isNull();
}
@Test
- void loggedApplicationGroupWhenApplicationGroupLoggingDisabled() {
+ void applicationGroupWhenApplicationGroupLoggingDisabled() {
new LoggingSystemProperties(new MockEnvironment().withProperty("spring.application.group", "test")
.withProperty("logging.include-application-group", "false")).apply(null);
assertThat(getSystemProperty(LoggingSystemProperty.APPLICATION_GROUP)).isNull();
diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystemTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystemTests.java
index dd7446367260..fccfc2f8f157 100644
--- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystemTests.java
+++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystemTests.java
@@ -586,7 +586,7 @@ void applicationNameLoggingToConsoleWhenHasApplicationNameWithParenthesis(Captur
@Test
void applicationNameLoggingToConsoleWhenDisabled(CapturedOutput output) {
- this.environment.setProperty("spring.application.name", "application-name");
+ this.environment.setProperty("spring.application.name", "myapp");
this.environment.setProperty("logging.include-application-name", "false");
this.loggingSystem.setStandardConfigLocations(false);
this.loggingSystem.beforeInitialize();
@@ -625,7 +625,7 @@ void applicationNameLoggingToFileWhenHasApplicationNameWithParenthesis() {
@Test
void applicationNameLoggingToFileWhenDisabled() {
- this.environment.setProperty("spring.application.name", "application-name");
+ this.environment.setProperty("spring.application.name", "myapp");
this.environment.setProperty("logging.include-application-name", "false");
new LoggingSystemProperties(this.environment).apply();
File file = new File(tmpDir(), "log4j2-test.log");
@@ -661,15 +661,14 @@ void applicationGroupLoggingToConsoleWhenHasApplicationGroupWithParenthesis(Capt
@Test
void applicationGroupLoggingToConsoleWhenDisabled(CapturedOutput output) {
- this.environment.setProperty("spring.application.group", "application-group");
+ this.environment.setProperty("spring.application.group", "mygroup");
this.environment.setProperty("logging.include-application-group", "false");
this.loggingSystem.setStandardConfigLocations(false);
this.loggingSystem.beforeInitialize();
this.loggingSystem.initialize(this.initializationContext, null, null);
this.logger.info("Hello world");
- assertThat(getLineWithText(output, "Hello world")).doesNotContain("${sys:LOGGED_APPLICATION_GROUP}")
- .doesNotContain("${sys:APPLICATION_GROUP}")
- .doesNotContain("myapp");
+ assertThat(getLineWithText(output, "Hello world")).doesNotContain("${sys:APPLICATION_GROUP}")
+ .doesNotContain("mygroup");
}
@Test
@@ -700,7 +699,7 @@ void applicationGroupLoggingToFileWhenHasApplicationGroupWithParenthesis() {
@Test
void applicationGroupLoggingToFileWhenDisabled() {
- this.environment.setProperty("spring.application.group", "application-group");
+ this.environment.setProperty("spring.application.group", "mygroup");
this.environment.setProperty("logging.include-application-group", "false");
new LoggingSystemProperties(this.environment).apply();
File file = new File(tmpDir(), "log4j2-test.log");
@@ -709,9 +708,8 @@ void applicationGroupLoggingToFileWhenDisabled() {
this.loggingSystem.beforeInitialize();
this.loggingSystem.initialize(this.initializationContext, null, logFile);
this.logger.info("Hello world");
- assertThat(getLineWithText(file, "Hello world")).doesNotContain("${sys:LOGGED_APPLICATION_GROUP}")
- .doesNotContain("${sys:APPLICATION_GROUP}")
- .doesNotContain("myapp");
+ assertThat(getLineWithText(file, "Hello world")).doesNotContain("${sys:APPLICATION_GROUP}")
+ .doesNotContain("mygroup");
}
@Test
diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java
index 642fc388ef80..239ae546bb8c 100644
--- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java
+++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java
@@ -20,7 +20,6 @@
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
-import java.util.Arrays;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.List;
@@ -571,8 +570,7 @@ void initializeShouldApplyLogbackSystemPropertiesToTheContext() {
Stream.of(LoggingSystemProperty.values())
.map(LoggingSystemProperty::getEnvironmentVariableName)
.forEach(expectedProperties::add);
- expectedProperties
- .removeAll(Arrays.asList("LOG_FILE", "LOG_PATH", "LOGGED_APPLICATION_NAME", "LOGGED_APPLICATION_GROUP"));
+ expectedProperties.removeAll(List.of("LOG_FILE", "LOG_PATH"));
expectedProperties.add("org.jboss.logging.provider");
expectedProperties.add("LOG_CORRELATION_PATTERN");
expectedProperties.add("CONSOLE_LOG_STRUCTURED_FORMAT");
@@ -822,7 +820,7 @@ void applicationNameLoggingToFileWhenHasApplicationNameWithParenthesis() {
}
@Test
- void applicationNameLoggingToFileWhenDisabled(CapturedOutput output) {
+ void applicationNameLoggingToFileWhenDisabled() {
this.environment.setProperty("spring.application.name", "myapp");
this.environment.setProperty("logging.include-application-name", "false");
File file = new File(tmpDir(), "logback-test.log");
@@ -939,7 +937,7 @@ void applicationGroupLoggingToFileWhenHasApplicationGroupWithParenthesis() {
}
@Test
- void applicationGroupLoggingToFileWhenDisabled(CapturedOutput output) {
+ void applicationGroupLoggingToFileWhenDisabled() {
this.environment.setProperty("spring.application.group", "myGroup");
this.environment.setProperty("logging.include-application-group", "false");
File file = new File(tmpDir(), "logback-test.log");
diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-actuator-log4j2/src/main/resources/log4j2.xml b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-actuator-log4j2/src/main/resources/log4j2.xml
index ba8b3efd9caa..3f36c38809b5 100644
--- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-actuator-log4j2/src/main/resources/log4j2.xml
+++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-actuator-log4j2/src/main/resources/log4j2.xml
@@ -2,7 +2,7 @@
????
- %clr{%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}}{faint} %clr{%5p} %clr{${sys:PID}}{magenta} %clr{---}{faint} %clr{${sys:LOGGED_APPLICATION_NAME:-}${sys:LOGGED_APPLICATION_GROUP:-}[%15.15t]}{faint} %clr{%-40.40c{1.}}{cyan} %clr{:}{faint} %m%n%xwEx
+ %clr{%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}}{faint} %clr{%5p} %clr{${sys:PID}}{magenta} %clr{---}{faint} %clr{${sys:APPLICATION_NAME:-}${sys:APPLICATION_GROUP:-}[%15.15t]}{faint} %clr{%-40.40c{1.}}{cyan} %clr{:}{faint} %m%n%xwEx