diff --git a/spring-boot-actuator-docs/src/main/asciidoc/index.adoc b/spring-boot-actuator-docs/src/main/asciidoc/index.adoc index 3b4534e3b23..9f15bdb7ff2 100644 --- a/spring-boot-actuator-docs/src/main/asciidoc/index.adoc +++ b/spring-boot-actuator-docs/src/main/asciidoc/index.adoc @@ -34,6 +34,19 @@ include::{generated}/logfile/http-request.adoc[] Example HTTP response: include::{generated}/logfile/http-response.adoc[] +==== Partial content + +You can use the `Range` header to retrieve part of the log file's content. + +Example curl request: +include::{generated}/partial-logfile/curl-request.adoc[] + +Example HTTP request: +include::{generated}/partial-logfile/http-request.adoc[] + +Example HTTP response: +include::{generated}/partial-logfile/http-response.adoc[] + === /docs diff --git a/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/EndpointDocumentation.java b/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/EndpointDocumentation.java index beae9111b11..1a4b5b2b6d6 100644 --- a/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/EndpointDocumentation.java +++ b/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/EndpointDocumentation.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2016 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. @@ -40,6 +40,7 @@ import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.actuate.endpoint.mvc.MvcEndpoint; import org.springframework.boot.actuate.endpoint.mvc.MvcEndpoints; import org.springframework.boot.test.SpringApplicationConfiguration; +import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.restdocs.RestDocumentation; import org.springframework.test.annotation.DirtiesContext; @@ -104,6 +105,15 @@ public class EndpointDocumentation { .andExpect(status().isOk()).andDo(document("logfile")); } + @Test + public void partialLogfile() throws Exception { + this.mockMvc + .perform(get("/logfile").accept(MediaType.TEXT_PLAIN) + .header(HttpHeaders.RANGE, "bytes=0-1024")) + .andExpect(status().isPartialContent()) + .andDo(document("partial-logfile")); + } + @Test public void endpoints() throws Exception { diff --git a/spring-boot-actuator-docs/src/restdoc/resources/org/springframework/restdocs/templates/http-response.snippet b/spring-boot-actuator-docs/src/restdoc/resources/org/springframework/restdocs/templates/http-response.snippet new file mode 100644 index 00000000000..90a25e85142 --- /dev/null +++ b/spring-boot-actuator-docs/src/restdoc/resources/org/springframework/restdocs/templates/http-response.snippet @@ -0,0 +1,8 @@ +[source,http,options="nowrap"] +---- +HTTP/1.1 {{statusCode}} {{statusReason}} +{{#headers}} +{{name}}: {{value}} +{{/headers}} +{{responseBody}} +---- \ No newline at end of file diff --git a/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc b/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc index c70007b8655..d9251c3fdff 100644 --- a/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc +++ b/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc @@ -118,7 +118,8 @@ unauthenticated connection or full message details when authenticated). |`logfile` |Returns the contents of the logfile (if `logging.file` or `logging.path` properties have -been set). Only available via MVC. +been set). Only available via MVC. Supports the use of the HTTP `Range` header to retrieve +part of the log file's content. |true |`metrics`