For the latest stable version, please use Spring Boot 3.4.0!spring-doc.cn

Loggers (loggers)

The loggers endpoint provides access to the application’s loggers and the configuration of their levels.spring-doc.cn

Retrieving All Loggers

To retrieve the application’s loggers, make a GET request to /actuator/loggers, as shown in the following curl-based example:spring-doc.cn

$ curl 'http://localhost:8080/actuator/loggers' -i -X GET

The resulting response is similar to the following:spring-doc.cn

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:spring-doc.cn

Path Type Description

levelsspring-doc.cn

Arrayspring-doc.cn

Levels support by the logging system.spring-doc.cn

loggersspring-doc.cn

Objectspring-doc.cn

Loggers keyed by name.spring-doc.cn

groupsspring-doc.cn

Objectspring-doc.cn

Logger groups keyed by namespring-doc.cn

loggers.*.configuredLevelspring-doc.cn

Stringspring-doc.cn

Configured level of the logger, if any.spring-doc.cn

loggers.*.effectiveLevelspring-doc.cn

Stringspring-doc.cn

Effective level of the logger.spring-doc.cn

groups.*.configuredLevelspring-doc.cn

Stringspring-doc.cn

Configured level of the logger group, if any.spring-doc.cn

groups.*.membersspring-doc.cn

Arrayspring-doc.cn

Loggers that are part of this groupspring-doc.cn

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:spring-doc.cn

$ 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:spring-doc.cn

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"
}

Response Structure

The response contains details of the requested logger. The following table describes the structure of the response:spring-doc.cn

Path Type Description

configuredLevelspring-doc.cn

Stringspring-doc.cn

Configured level of the logger, if any.spring-doc.cn

effectiveLevelspring-doc.cn

Stringspring-doc.cn

Effective level of the logger.spring-doc.cn

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:spring-doc.cn

$ 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:spring-doc.cn

HTTP/1.1 200 OK
Content-Type: application/vnd.spring-boot.actuator.v3+json
Content-Length: 82

{
  "configuredLevel" : "INFO",
  "members" : [ "test.member1", "test.member2" ]
}

Response Structure

The response contains details of the requested group. The following table describes the structure of the response:spring-doc.cn

Path Type Description

configuredLevelspring-doc.cn

Stringspring-doc.cn

Configured level of the logger group, if any.spring-doc.cn

membersspring-doc.cn

Arrayspring-doc.cn

Loggers that are part of this groupspring-doc.cn

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:spring-doc.cn

$ 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.spring-doc.cn

Request Structure

The request specifies the desired level of the logger. The following table describes the structure of the request:spring-doc.cn

Path Type Description

configuredLevelspring-doc.cn

Stringspring-doc.cn

Level for the logger. May be omitted to clear the level.spring-doc.cn

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:spring-doc.cn

$ 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.spring-doc.cn

Request Structure

The request specifies the desired level of the logger group. The following table describes the structure of the request:spring-doc.cn

Path Type Description

configuredLevelspring-doc.cn

Stringspring-doc.cn

Level for the logger. May be omitted to clear the level.spring-doc.cn

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:spring-doc.cn

$ 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.spring-doc.cn