Skip to content

Commit 12d8f94

Browse files
committed
Stop logging to the file used in the generated documentation
Closes gh-28488
1 parent e4e1958 commit 12d8f94

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/LogFileWebEndpointDocumentationTests.java

Lines changed: 6 additions & 6 deletions
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-2021 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.
@@ -23,9 +23,8 @@
2323
import org.springframework.context.annotation.Bean;
2424
import org.springframework.context.annotation.Configuration;
2525
import org.springframework.context.annotation.Import;
26-
import org.springframework.core.env.Environment;
26+
import org.springframework.mock.env.MockEnvironment;
2727
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
28-
import org.springframework.test.context.TestPropertySource;
2928

3029
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
3130
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@@ -35,8 +34,6 @@
3534
*
3635
* @author Andy Wilkinson
3736
*/
38-
@TestPropertySource(
39-
properties = "logging.file.name=src/test/resources/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/sample.log")
4037
class LogFileWebEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
4138

4239
@Test
@@ -56,7 +53,10 @@ void logFileRange() throws Exception {
5653
static class TestConfiguration {
5754

5855
@Bean
59-
LogFileWebEndpoint endpoint(Environment environment) {
56+
LogFileWebEndpoint endpoint() {
57+
MockEnvironment environment = new MockEnvironment();
58+
environment.setProperty("logging.file.name",
59+
"src/test/resources/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/sample.log");
6060
return new LogFileWebEndpoint(LogFile.get(environment), null);
6161
}
6262

0 commit comments

Comments
 (0)