Skip to content

Commit ce907b1

Browse files
committed
Merge branch '2.2.x' into 2.3.x
Closes gh-22010
2 parents 8a7c32f + 1b62aba commit ce907b1

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/DefaultLogbackConfiguration.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -139,6 +139,7 @@ private Appender<ILoggingEvent> fileAppender(LogbackConfigurator config, String
139139
private void setRollingPolicy(RollingFileAppender<ILoggingEvent> appender, LogbackConfigurator config,
140140
String logFile) {
141141
SizeAndTimeBasedRollingPolicy<ILoggingEvent> rollingPolicy = new SizeAndTimeBasedRollingPolicy<>();
142+
rollingPolicy.setContext(config.getContext());
142143
rollingPolicy.setCleanHistoryOnStart(
143144
this.patterns.getProperty("logging.file.clean-history-on-start", Boolean.class, false));
144145
rollingPolicy.setFileNamePattern(

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ void withFile(CapturedOutput output) {
111111
this.loggingSystem.initialize(this.initializationContext, null, getLogFile(null, tmpDir()));
112112
this.logger.info("Hello world");
113113
File file = new File(tmpDir() + "/spring.log");
114+
assertThat(output).doesNotContain("LOGBACK:");
114115
assertThat(output).contains("Hello world").doesNotContain("Hidden");
115116
assertThat(getLineWithText(output, "Hello world")).contains("INFO");
116117
assertThat(file.exists()).isTrue();

0 commit comments

Comments
 (0)