I have deployed springboot application in PCF . I want to log the message based on the environment variable .What should I do so that the run time log level change will work without restarting the application?
Changing the log level in Spring Boot 1.5+ can be done with a http-endpoint
Add
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
and than you can use
curl -X "POST" "http://localhost:8080/loggers/de.springbootbuch" \
-H "Content-Type: application/json; charset=utf-8" \
-d $'{
"configuredLevel": "WARN"
}'
Where everything beyond /loggers/ is the name of the logger.
If you running this in PCF it get's even better: This is directly supported from their backend.