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

Array

Levels support by the logging system.

loggers

Object

Loggers keyed by name.

groups

Object

Logger groups keyed by name

loggers.*.configuredLevel

String

Configured level of the logger, if any.

loggers.*.effectiveLevel

String

Effective level of the logger.

groups.*.configuredLevel

String

Configured level of the logger group, if any.

groups.*.members

Array

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

Response Structure

The response contains details of the requested logger. The following table describes the structure of the response:

Path Type Description

configuredLevel

String

Configured level of the logger, if any.

effectiveLevel

String

Effective level of the logger.

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

Response Structure

The response contains details of the requested group. The following table describes the structure of the response:

Path Type Description

configuredLevel

String

Configured level of the logger group, if any.

members

Array

Loggers that are part of this group

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.

Request Structure

The request specifies the desired level of the logger. The following table describes the structure of the request:

Path Type Description

configuredLevel

String

Level for the logger. May be omitted to clear the level.

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.

Request Structure

The request specifies the desired level of the logger group. The following table describes the structure of the request:

Path Type Description

configuredLevel

String

Level for the logger. May be omitted to clear the level.

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.