mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Stop logging to the file used in the generated documentation
Closes gh-28488
This commit is contained in:
parent
e4e1958b65
commit
12d8f942be
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2021 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -23,9 +23,8 @@ import org.springframework.boot.logging.LogFile;
|
|||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
import org.springframework.core.env.Environment;
|
import org.springframework.mock.env.MockEnvironment;
|
||||||
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
|
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
|
||||||
import org.springframework.test.context.TestPropertySource;
|
|
||||||
|
|
||||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
||||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||||
@ -35,8 +34,6 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
|||||||
*
|
*
|
||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
*/
|
*/
|
||||||
@TestPropertySource(
|
|
||||||
properties = "logging.file.name=src/test/resources/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/sample.log")
|
|
||||||
class LogFileWebEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
|
class LogFileWebEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -56,7 +53,10 @@ class LogFileWebEndpointDocumentationTests extends MockMvcEndpointDocumentationT
|
|||||||
static class TestConfiguration {
|
static class TestConfiguration {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
LogFileWebEndpoint endpoint(Environment environment) {
|
LogFileWebEndpoint endpoint() {
|
||||||
|
MockEnvironment environment = new MockEnvironment();
|
||||||
|
environment.setProperty("logging.file.name",
|
||||||
|
"src/test/resources/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/sample.log");
|
||||||
return new LogFileWebEndpoint(LogFile.get(environment), null);
|
return new LogFileWebEndpoint(LogFile.get(environment), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user