Skip to content

Commit a5e0f47

Browse files
committed
Remove unsupported Log4j2 rolling policy properties
Signed-off-by: hojooo <ghwn5833@gmail.com>
1 parent dcd09d2 commit a5e0f47

File tree

5 files changed

+0
-37
lines changed

5 files changed

+0
-37
lines changed

core/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4j2LoggingSystemProperties.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,7 @@ private void applyRollingPolicyProperties(PropertyResolver resolver) {
7777
applyRollingPolicy(Log4j2RollingPolicySystemProperty.TIME_MODULATE, resolver, Boolean.class);
7878
applyRollingPolicy(Log4j2RollingPolicySystemProperty.CRON_SCHEDULE, resolver);
7979
applyRollingPolicy(Log4j2RollingPolicySystemProperty.FILE_NAME_PATTERN, resolver);
80-
applyRollingPolicy(Log4j2RollingPolicySystemProperty.CLEAN_HISTORY_ON_START, resolver);
8180
applyRollingPolicy(Log4j2RollingPolicySystemProperty.MAX_FILE_SIZE, resolver, DataSize.class);
82-
applyRollingPolicy(Log4j2RollingPolicySystemProperty.TOTAL_SIZE_CAP, resolver, DataSize.class);
8381
applyRollingPolicy(Log4j2RollingPolicySystemProperty.MAX_HISTORY, resolver);
8482
}
8583

core/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4j2RollingPolicySystemProperty.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,11 @@ public enum Log4j2RollingPolicySystemProperty {
3333
*/
3434
FILE_NAME_PATTERN("file-name-pattern", "logging.pattern.rolling-file-name"),
3535

36-
/**
37-
* Logging system property for the clean history on start flag.
38-
*/
39-
CLEAN_HISTORY_ON_START("clean-history-on-start", "logging.file.clean-history-on-start"),
40-
4136
/**
4237
* Logging system property for the file log max size.
4338
*/
4439
MAX_FILE_SIZE("max-file-size", "logging.file.max-size"),
4540

46-
/**
47-
* Logging system property for the file total size cap.
48-
*/
49-
TOTAL_SIZE_CAP("total-size-cap", "logging.file.total-size-cap"),
50-
5141
/**
5242
* Logging system property for the file log max history.
5343
*/

core/spring-boot/src/main/resources/META-INF/additional-spring-configuration-metadata.json

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,6 @@
139139
"type": "java.util.List<java.lang.String>",
140140
"description": "Overriding configuration files used to create a composite configuration. Can be prefixed with 'optional:' to only load the override if it exists."
141141
},
142-
{
143-
"name": "logging.log4j2.rollingpolicy.clean-history-on-start",
144-
"type": "java.lang.Boolean",
145-
"description": "Whether to clean the archive log files on startup.",
146-
"sourceType": "org.springframework.boot.context.logging.LoggingApplicationListener",
147-
"defaultValue": false
148-
},
149142
{
150143
"name": "logging.log4j2.rollingpolicy.cron.schedule",
151144
"type": "java.lang.String",
@@ -194,13 +187,6 @@
194187
"sourceType": "org.springframework.boot.context.logging.LoggingApplicationListener",
195188
"defaultValue": false
196189
},
197-
{
198-
"name": "logging.log4j2.rollingpolicy.total-size-cap",
199-
"type": "org.springframework.util.unit.DataSize",
200-
"description": "Total size of log backups to be kept.",
201-
"sourceType": "org.springframework.boot.context.logging.LoggingApplicationListener",
202-
"defaultValue": "0B"
203-
},
204190
{
205191
"name": "logging.logback.rollingpolicy.clean-history-on-start",
206192
"type": "java.lang.Boolean",

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@
7676
import org.springframework.mock.env.MockEnvironment;
7777
import org.springframework.util.ClassUtils;
7878
import org.springframework.util.StringUtils;
79-
import org.springframework.util.unit.DataSize;
8079

8180
import static org.assertj.core.api.Assertions.assertThat;
8281
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
@@ -782,8 +781,6 @@ private String getRelativeClasspathLocation(String fileName) {
782781
void rollingPolicySystemPropertiesAreApplied() {
783782
this.environment.setProperty("logging.log4j2.rollingpolicy.max-file-size", "50MB");
784783
this.environment.setProperty("logging.log4j2.rollingpolicy.max-history", "30");
785-
this.environment.setProperty("logging.log4j2.rollingpolicy.clean-history-on-start", "true");
786-
this.environment.setProperty("logging.log4j2.rollingpolicy.total-size-cap", "5GB");
787784
this.environment.setProperty("logging.log4j2.rollingpolicy.file-name-pattern",
788785
"${LOG_FILE}.%d{yyyy-MM-dd}.%i.log");
789786
File file = new File(tmpDir(), "log4j2-test.log");
@@ -792,13 +789,9 @@ void rollingPolicySystemPropertiesAreApplied() {
792789
this.loggingSystem.initialize(this.initializationContext, null, logFile);
793790
String maxFileSize = System.getProperty("LOG4J2_ROLLINGPOLICY_MAX_FILE_SIZE");
794791
String maxHistory = System.getProperty("LOG4J2_ROLLINGPOLICY_MAX_HISTORY");
795-
String cleanHistoryOnStart = System.getProperty("LOG4J2_ROLLINGPOLICY_CLEAN_HISTORY_ON_START");
796-
String totalSizeCap = System.getProperty("LOG4J2_ROLLINGPOLICY_TOTAL_SIZE_CAP");
797792
String fileNamePattern = System.getProperty("LOG4J2_ROLLINGPOLICY_FILE_NAME_PATTERN");
798793
assertThat(maxFileSize).isEqualTo(String.valueOf(50 * 1024 * 1024));
799794
assertThat(maxHistory).isEqualTo("30");
800-
assertThat(cleanHistoryOnStart).isEqualTo("true");
801-
assertThat(totalSizeCap).isEqualTo(String.valueOf(DataSize.ofGigabytes(5).toBytes()));
802795
assertThat(fileNamePattern).isEqualTo("${LOG_FILE}.%d{yyyy-MM-dd}.%i.log");
803796
}
804797

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,7 @@ void restoreSystemProperties() {
6262
@Test
6363
void appliesLog4j2RollingPolicyProperties() {
6464
this.environment.setProperty("logging.log4j2.rollingpolicy.max-file-size", "50MB");
65-
this.environment.setProperty("logging.log4j2.rollingpolicy.clean-history-on-start", "true");
6665
this.environment.setProperty("logging.log4j2.rollingpolicy.max-history", "30");
67-
this.environment.setProperty("logging.log4j2.rollingpolicy.total-size-cap", "10GB");
6866
this.environment.setProperty("logging.log4j2.rollingpolicy.file-name-pattern", "test.%d{yyyy-MM-dd}.%i.log");
6967
this.environment.setProperty("logging.log4j2.rollingpolicy.strategy", "time");
7068
this.environment.setProperty("logging.log4j2.rollingpolicy.time-based.interval", "2");
@@ -75,9 +73,7 @@ void appliesLog4j2RollingPolicyProperties() {
7573

7674
assertThat(System.getProperties())
7775
.containsEntry("LOG4J2_ROLLINGPOLICY_MAX_FILE_SIZE", String.valueOf(DataSize.ofMegabytes(50).toBytes()))
78-
.containsEntry("LOG4J2_ROLLINGPOLICY_CLEAN_HISTORY_ON_START", "true")
7976
.containsEntry("LOG4J2_ROLLINGPOLICY_MAX_HISTORY", "30")
80-
.containsEntry("LOG4J2_ROLLINGPOLICY_TOTAL_SIZE_CAP", String.valueOf(DataSize.ofGigabytes(10).toBytes()))
8177
.containsEntry("LOG4J2_ROLLINGPOLICY_FILE_NAME_PATTERN", "test.%d{yyyy-MM-dd}.%i.log")
8278
.containsEntry("LOG4J2_ROLLINGPOLICY_STRATEGY", "time")
8379
.containsEntry("LOG4J2_ROLLINGPOLICY_TIME_INTERVAL", "2")

0 commit comments

Comments
 (0)