Spring boot actuator loggers

Viewed 1355

When I check my loggers on web through spring actuator, there are two types of levels: configuredLevel, effectiveLevel. What is the difference between them? And what is the common?

2 Answers

Configured level is the level of configuration if you configured it one specifically If not when you:

curl http://localhost:8080/actuator/loggers/YOUR_CLASS

you will get something like this:

  {"configuredLevel":null,"effectiveLevel":"INFO"}

INFO is the default configuration for loggers in spring.

If you change it to something specific like WARN you will get

{"configuredLevel":"WARN","effectiveLevel":"WARN"}

I don't know exactly what you mean by what is the common, hope i answered it above.

Loggers inherit the log level from the parent logger (e.g. ROOT)

configuredLevel has a value when the log level was explicitly set to the logger or null if the inherited level is used.

effectiveLevel contains the actual log level. if no log level was set to the logger it will have inherited value otherwise it will have configuredLevel.

Example output:

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

For "com.example" the INFO level was set, "org.example" uses the inherited value from the ROOT logger.

Related