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
For Spring Boot 2.1.5+:
First, you need the actuator Plugin:
org.springframework.boot
spring-boot-starter-actuator
Second, you need to expose the endpoint like Dennis said in his comment (loggers is disabled by default):
management.endpoints.web.exposure.include=health,info,loggers
Finally, you can use the Rest Endpoints to get Information about the loggers and set the logging levels.
curl -X "GET" "http://localhost:8080/actuator/loggers"
To set the Root logging Level you can use
curl -X "POST" "http://localhost:8080/actuator/loggers/ROOT" -H "Content-Type: application/json; charset=utf-8" -d $'{ "configuredLevel": "INFO" }'