Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
ffbc545a
Commit
ffbc545a
authored
May 21, 2019
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change Logback's maxHistory property default to 7 days
Closes gh-15875
parent
06c9e998
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
6 deletions
+6
-6
DefaultLogbackConfiguration.java
...ork/boot/logging/logback/DefaultLogbackConfiguration.java
+3
-1
additional-spring-configuration-metadata.json
...es/META-INF/additional-spring-configuration-metadata.json
+1
-1
file-appender.xml
...rg/springframework/boot/logging/logback/file-appender.xml
+1
-1
LogbackLoggingSystemTests.java
...ework/boot/logging/logback/LogbackLoggingSystemTests.java
+1
-3
No files found.
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/DefaultLogbackConfiguration.java
View file @
ffbc545a
...
...
@@ -61,6 +61,8 @@ class DefaultLogbackConfiguration {
private
static
final
DataSize
MAX_FILE_SIZE
=
DataSize
.
ofMegabytes
(
10
);
private
static
final
Integer
MAX_FILE_HISTORY
=
7
;
private
final
PropertyResolver
patterns
;
private
final
LogFile
logFile
;
...
...
@@ -148,7 +150,7 @@ class DefaultLogbackConfiguration {
setMaxFileSize
(
rollingPolicy
,
getDataSize
(
"logging.file.max-size"
,
MAX_FILE_SIZE
));
rollingPolicy
.
setMaxHistory
(
this
.
patterns
.
getProperty
(
"logging.file.max-history"
,
Integer
.
class
,
CoreConstants
.
UNBOUND
_HISTORY
));
Integer
.
class
,
MAX_FILE
_HISTORY
));
DataSize
totalSizeCap
=
getDataSize
(
"logging.file.total-size-cap"
,
DataSize
.
ofBytes
(
CoreConstants
.
UNBOUNDED_TOTAL_SIZE_CAP
));
rollingPolicy
.
setTotalSizeCap
(
new
FileSize
(
totalSizeCap
.
toBytes
()));
...
...
spring-boot-project/spring-boot/src/main/resources/META-INF/additional-spring-configuration-metadata.json
View file @
ffbc545a
...
...
@@ -107,7 +107,7 @@
"type"
:
"java.lang.Integer"
,
"description"
:
"Maximum of archive log files to keep. Only supported with the default logback setup."
,
"sourceType"
:
"org.springframework.boot.context.logging.LoggingApplicationListener"
,
"defaultValue"
:
0
"defaultValue"
:
7
},
{
"name"
:
"logging.file.total-size-cap"
,
...
...
spring-boot-project/spring-boot/src/main/resources/org/springframework/boot/logging/logback/file-appender.xml
View file @
ffbc545a
...
...
@@ -16,7 +16,7 @@ initialization performed by Boot
<cleanHistoryOnStart>
${LOG_FILE_CLEAN_HISTORY_ON_START:-false}
</cleanHistoryOnStart>
<fileNamePattern>
${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz
</fileNamePattern>
<maxFileSize>
${LOG_FILE_MAX_SIZE:-10MB}
</maxFileSize>
<maxHistory>
${LOG_FILE_MAX_HISTORY:-
0
}
</maxHistory>
<maxHistory>
${LOG_FILE_MAX_HISTORY:-
7
}
</maxHistory>
<totalSizeCap>
${LOG_FILE_TOTAL_SIZE_CAP:-0}
</totalSizeCap>
</rollingPolicy>
</appender>
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java
View file @
ffbc545a
...
...
@@ -27,7 +27,6 @@ import ch.qos.logback.classic.Logger;
import
ch.qos.logback.classic.LoggerContext
;
import
ch.qos.logback.classic.spi.LoggerContextListener
;
import
ch.qos.logback.core.ConsoleAppender
;
import
ch.qos.logback.core.CoreConstants
;
import
ch.qos.logback.core.rolling.RollingFileAppender
;
import
ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy
;
import
org.hamcrest.Matcher
;
...
...
@@ -134,8 +133,7 @@ public class LogbackLoggingSystemTests extends AbstractLoggingSystemTests {
assertThat
(
getLineWithText
(
file
,
"Hello world"
)).
contains
(
"INFO"
);
assertThat
(
ReflectionTestUtils
.
getField
(
getRollingPolicy
(),
"maxFileSize"
)
.
toString
()).
isEqualTo
(
"10 MB"
);
assertThat
(
getRollingPolicy
().
getMaxHistory
())
.
isEqualTo
(
CoreConstants
.
UNBOUND_HISTORY
);
assertThat
(
getRollingPolicy
().
getMaxHistory
()).
isEqualTo
(
7
);
}
@Test
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment