Skip to content

Commit b1afd09

Browse files
committed
Document log file endpoint's support for using Range header
Closes gh-5062
1 parent a6b1f4c commit b1afd09

File tree

4 files changed

+34
-2
lines changed

4 files changed

+34
-2
lines changed

spring-boot-actuator-docs/src/main/asciidoc/index.adoc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,19 @@ include::{generated}/logfile/http-request.adoc[]
3434
Example HTTP response:
3535
include::{generated}/logfile/http-response.adoc[]
3636

37+
==== Partial content
38+
39+
You can use the `Range` header to retrieve part of the log file's content.
40+
41+
Example curl request:
42+
include::{generated}/partial-logfile/curl-request.adoc[]
43+
44+
Example HTTP request:
45+
include::{generated}/partial-logfile/http-request.adoc[]
46+
47+
Example HTTP response:
48+
include::{generated}/partial-logfile/http-response.adoc[]
49+
3750

3851

3952
=== /docs

spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/EndpointDocumentation.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2015 the original author or authors.
2+
* Copyright 2012-2016 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.
@@ -40,6 +40,7 @@
4040
import org.springframework.boot.actuate.endpoint.mvc.MvcEndpoint;
4141
import org.springframework.boot.actuate.endpoint.mvc.MvcEndpoints;
4242
import org.springframework.boot.test.SpringApplicationConfiguration;
43+
import org.springframework.http.HttpHeaders;
4344
import org.springframework.http.MediaType;
4445
import org.springframework.restdocs.RestDocumentation;
4546
import org.springframework.test.annotation.DirtiesContext;
@@ -104,6 +105,15 @@ public void logfile() throws Exception {
104105
.andExpect(status().isOk()).andDo(document("logfile"));
105106
}
106107

108+
@Test
109+
public void partialLogfile() throws Exception {
110+
this.mockMvc
111+
.perform(get("/logfile").accept(MediaType.TEXT_PLAIN)
112+
.header(HttpHeaders.RANGE, "bytes=0-1024"))
113+
.andExpect(status().isPartialContent())
114+
.andDo(document("partial-logfile"));
115+
}
116+
107117
@Test
108118
public void endpoints() throws Exception {
109119

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[source,http,options="nowrap"]
2+
----
3+
HTTP/1.1 {{statusCode}} {{statusReason}}
4+
{{#headers}}
5+
{{name}}: {{value}}
6+
{{/headers}}
7+
{{responseBody}}
8+
----

spring-boot-docs/src/main/asciidoc/production-ready-features.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ unauthenticated connection or full message details when authenticated).
118118

119119
|`logfile`
120120
|Returns the contents of the logfile (if `logging.file` or `logging.path` properties have
121-
been set). Only available via MVC.
121+
been set). Only available via MVC. Supports the use of the HTTP `Range` header to retrieve
122+
part of the log file's content.
122123
|true
123124

124125
|`metrics`

0 commit comments

Comments
 (0)