Improve Web DEBUG logging output configuration

Since SPR-16946, Spring Framework revisited the DEBUG logging output
developers get while working on Spring MVC and Spring WebFlux
applications.

This commit aligns to those changes where DEBUG output was produced
in Spring Boot (especially in `DefaultErrorWebExceptionHandler`).

This also enables DEBUG logging on the related packages when running an
application with Spring Boot Developer Tools, providing a better
development experience.

This is also adding the new `spring.insights.web.log-request-details`
configuration property, which logs additional information about the
incoming requests at the DEBUG and TRACE levels. Since that information
can be sensitive (e.g. credentials, tokens, etc.), this property is not
enabled by default nor activated by the Developer Tools.

Closes: gh-13511
This commit is contained in:
Brian Clozel
2018-08-16 17:34:42 +02:00
parent 13f08e4c89
commit f2511b7fa3
9 changed files with 107 additions and 50 deletions

View File

@@ -92,6 +92,9 @@ content into your application. Rather, pick only the properties that you need.
# HAZELCAST ({sc-spring-boot-autoconfigure}/hazelcast/HazelcastProperties.{sc-ext}[HazelcastProperties])
spring.hazelcast.config= # The location of the configuration file to use to initialize Hazelcast.
# INSIGHTS
spring.insights.web.log-request-details=false # Whether logging of (potentially sensitive) request details at DEBUG and TRACE level is allowed.
# PROJECT INFORMATION ({sc-spring-boot-autoconfigure}/info/ProjectInfoProperties.{sc-ext}[ProjectInfoProperties])
spring.info.build.location=classpath:META-INF/build-info.properties # Location of the generated build-info.properties file.
spring.info.git.location=classpath:git.properties # Location of the generated git.properties file.

View File

@@ -781,6 +781,13 @@ For example, Thymeleaf offers the `spring.thymeleaf.cache` property. Rather than
to set these properties manually, the `spring-boot-devtools` module automatically applies
sensible development-time configuration.
Because you need more information about web requests while developing Spring MVC and
Spring WebFlux applications, developer tools will enable DEBUG logging for the
Spring Framework web infrastructure. This will give you information about the incoming
request, which handler is processing it, the response outcome, etc. If you wish to log
all request details (including potentially sensitive information), you can turn on
the `spring.insights.web.log-request-details` configuration property.
TIP: For a complete list of the properties that are applied by the devtools, see
{sc-spring-boot-devtools}/env/DevToolsPropertyDefaultsPostProcessor.{sc-ext}[DevToolsPropertyDefaultsPostProcessor].