Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set enableLoggingRequestDetails='true' in Spring Boot

I'm trying to debug my app today but the spring boot console displays the following message:

enableLoggingRequestDetails='false': request parameters and headers will be masked to prevent unsafe logging of potentially sensitive data

Meanwhile, I want to know everything that is going on in the app.

So my question is: How can I enable logging request details in application.properties?

like image 933
Adindu Stevens Avatar asked Dec 11 '18 11:12

Adindu Stevens


People also ask

How do you log an object in spring boot?

As said in the official reference, Spring Boot use Logback by default as logging service. You can set advanced configurations using the logback. xml file, placing it in src/main/resources/logback. xml (so Maven or Gradle will copy it in the classpath root).

What is the use of spring boot framework?

Spring Boot helps developers create applications that just run. Specifically, it lets you create standalone applications that run on their own, without relying on an external web server, by embedding a web server such as Tomcat or Netty into your app during the initialization process.


2 Answers

For Spring Boot 2.1 and below use

logging.level.org.springframework.web=DEBUG
spring.http.log-request-details=true

For Spring Boot 2.2 and above spring.http.log-request-details has been deprecated so use

logging.level.org.springframework.web=DEBUG
spring.mvc.log-request-details=true

in your application.properties if you want to see loggingRequestDetails.

From the documentation:

Whether logging of (potentially sensitive) request details at DEBUG and TRACE level is allowed.

like image 100
Arigion Avatar answered Oct 23 '22 09:10

Arigion


When using webflux and spring boot 2.3.0 the following properties can be set to log request details.

logging.level.org.springframework.web.server.adapter.HttpWebHandlerAdapter=DEBUG
spring.codec.log-request-details=true
like image 10
Doctor Parameter Avatar answered Oct 23 '22 07:10

Doctor Parameter