Allow changes to org.springframework.web
log category at runtime
#28477
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
type: enhancement
A general enhancement
Milestone
In a Spring Boot application using the
spring-boot-starter-actuator
loggers endpoint, setting theweb
log group, or any of it's individual member loggers, todebug
level doesn't have any effect for RestTemplate logging.We would like to be able to use the loggers endpoint to change the web log group logger levels on a deployed application in order to see web related debug logging.
It appears HttpAccessor is using an
org.springframework.core.log.CompositeLog
which initializes at application startup to current log levels, so adjusting the log levels through the actuator loggers endpoint doesn't have the desired effect.Steps to duplicate:
Create a Spring Boot application using spring-initializr with
spring-boot-starter-web
andspring-boot-starter-actuator
.I am using Spring Boot 2.6.7
In application.properties, set:
logging.level.web=debug
Application code
Startup the application and execute:
curl --location --request GET 'localhost:8080/'
You should see the
[RestTemplate]
related logging in the application console.Now comment out the logger line in
application.properties
and restart the application.Now set the logger level after application startup using the actuators endpoint
Call the endpoint again
curl --location --request GET 'localhost:8080/'
Outcome
No
[RestTemplate]
related logging occurs.The text was updated successfully, but these errors were encountered: