Change your application log level with Spring Actuator

You can do it even at runtime 🙂

Spring Boot provides a loggers actuator endpoint for viewing and changing log levels at runtime. What do I need?

Add the Spring Boot Starter Actuator to you pom.xml or build.gradle

Expose at least the loggers endpoint in your

When exposed, you get all loggers details with /loggers:

curl | jq

"levels": ["OFF", "ERROR", "WARN", "INFO", "DEBUG", "TRACE"],
"loggers": {
"ROOT": {"configuredLevel": "INFO", "effectiveLevel": "INFO" },
"de": {"configuredLevel": null, "effectiveLevel": "INFO" },
"de.claudioaltamura": {"configuredLevel": null, "effectiveLevel": "INFO"}

For changing a specific logger level at runtime, execute a POST request:

curl -i -X POST -H 'Content-Type: application/json' -d '{"configuredLevel": "DEBUG"}' "http://localhost:8080/actuator/loggers/de.claudioaltamura"

HTTP/1.1 204

Try it out, here is my github project for this article.