Loggers (loggers
)
The loggers
endpoint provides access to the application’s loggers and the configuration of their levels.
Retrieving All Loggers
To retrieve the application’s loggers, make a GET
request to /actuator/loggers
, as shown in the following curl-based example:
$ curl 'http://localhost:8080/actuator/loggers' -i -X GET
The resulting response is similar to the following:
HTTP/1.1 200 OK
Content-Type: application/vnd.spring-boot.actuator.v3+json
Content-Length: 791
{
"levels" : [ "OFF", "FATAL", "ERROR", "WARN", "INFO", "DEBUG", "TRACE" ],
"loggers" : {
"ROOT" : {
"configuredLevel" : "INFO",
"effectiveLevel" : "INFO"
},
"com.example" : {
"configuredLevel" : "DEBUG",
"effectiveLevel" : "DEBUG"
}
},
"groups" : {
"test" : {
"configuredLevel" : "INFO",
"members" : [ "test.member1", "test.member2" ]
},
"web" : {
"members" : [ "org.springframework.core.codec", "org.springframework.http", "org.springframework.web", "org.springframework.boot.actuate.endpoint.web", "org.springframework.boot.web.servlet.ServletContextInitializerBeans" ]
},
"sql" : {
"members" : [ "org.springframework.jdbc.core", "org.hibernate.SQL", "org.jooq.tools.LoggerListener" ]
}
}
}
Response Structure
The response contains details of the application’s loggers. The following table describes the structure of the response:
Path | Type | Description |
---|---|---|
|
|
Levels support by the logging system. |
|
|
Loggers keyed by name. |
|
|
Logger groups keyed by name |
|
|
Configured level of the logger, if any. |
|
|
Effective level of the logger. |
|
|
Configured level of the logger group, if any. |
|
|
Loggers that are part of this group |
Retrieving a Single Logger
To retrieve a single logger, make a GET
request to /actuator/loggers/{logger.name}
, as shown in the following curl-based example:
$ curl 'http://localhost:8080/actuator/loggers/com.example' -i -X GET
The preceding example retrieves information about the logger named com.example
.
The resulting response is similar to the following:
HTTP/1.1 200 OK
Content-Disposition: inline;filename=f.txt
Content-Type: application/vnd.spring-boot.actuator.v3+json
Content-Length: 61
{
"configuredLevel" : "INFO",
"effectiveLevel" : "INFO"
}
Retrieving a Single Group
To retrieve a single group, make a GET
request to /actuator/loggers/{group.name}
,
as shown in the following curl-based example:
$ curl 'http://localhost:8080/actuator/loggers/test' -i -X GET
The preceding example retrieves information about the logger group named test
.
The resulting response is similar to the following:
HTTP/1.1 200 OK
Content-Type: application/vnd.spring-boot.actuator.v3+json
Content-Length: 82
{
"configuredLevel" : "INFO",
"members" : [ "test.member1", "test.member2" ]
}
Setting a Log Level
To set the level of a logger, make a POST
request to /actuator/loggers/{logger.name}
with a JSON body that specifies the configured level for the logger, as shown in the following curl-based example:
$ curl 'http://localhost:8080/actuator/loggers/com.example' -i -X POST \
-H 'Content-Type: application/json' \
-d '{"configuredLevel":"debug"}'
The preceding example sets the configuredLevel
of the com.example
logger to DEBUG
.
Setting a Log Level for a Group
To set the level of a logger, make a POST
request to /actuator/loggers/{group.name}
with a JSON body that specifies the configured level for the logger group, as shown in the following curl-based example:
$ curl 'http://localhost:8080/actuator/loggers/test' -i -X POST \
-H 'Content-Type: application/json' \
-d '{"configuredLevel":"debug"}'
The preceding example sets the configuredLevel
of the test
logger group to DEBUG
.
Clearing a Log Level
To clear the level of a logger, make a POST
request to /actuator/loggers/{logger.name}
with a JSON body containing an empty object, as shown in the following curl-based example:
$ curl 'http://localhost:8080/actuator/loggers/com.example' -i -X POST \
-H 'Content-Type: application/json' \
-d '{}'
The preceding example clears the configured level of the com.example
logger.