Commit 76758023 authored by Andy Wilkinson's avatar Andy Wilkinson

Merge branch '2.1.x'

parents 7d031741 f574213c
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -55,7 +55,7 @@ public class LogFileWebEndpoint {
this(environment, null);
}
@ReadOperation
@ReadOperation(produces = "text/plain")
public Resource logFile() {
Resource logFileResource = getLogFileResource();
if (logFileResource == null || !logFileResource.isReadable()) {
......
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -31,6 +31,7 @@ import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.http.MediaType;
import org.springframework.test.web.reactive.server.WebTestClient;
import org.springframework.util.FileCopyUtils;
......@@ -71,6 +72,14 @@ public class LogFileWebEndpointWebIntegrationTests {
.expectBody(String.class).isEqualTo("--TEST--");
}
@Test
public void getRequestThatAcceptsTextPlainProducesResponseWithLogFile() {
TestPropertyValues.of("logging.file:" + this.logFile.getAbsolutePath())
.applyTo(context);
client.get().uri("/actuator/logfile").accept(MediaType.TEXT_PLAIN).exchange()
.expectStatus().isOk().expectBody(String.class).isEqualTo("--TEST--");
}
@Configuration
static class TestConfiguration {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment