[[actuator.loggers]]
= Loggers

Spring Boot Actuator includes the ability to view and configure the log levels of your application at runtime.
You can view either the entire list or an individual logger's configuration, which is made up of both the explicitly configured logging level as well as the effective logging level given to it by the logging framework.
These levels can be one of:

* `TRACE`
* `DEBUG`
* `INFO`
* `WARN`
* `ERROR`
* `FATAL`
* `OFF`
* `null`

`null` indicates that there is no explicit configuration.



[[actuator.loggers.configure]]
== Configure a Logger

To configure a given logger, `POST` a partial entity to the resource's URI, as the following example shows:

[source,json]
----
{
	"configuredLevel": "DEBUG"
}
----

TIP: To "`reset`" the specific level of the logger (and use the default configuration instead), you can pass a value of `null` as the `configuredLevel`.



[[actuator.loggers.opentelemetry]]
== OpenTelemetry
By default, logging via OpenTelemetry is not configured.
You have to provide the location of the OpenTelemetry logs endpoint to configure it:

[configprops,yaml]
----
management:
  opentelemetry:
    logging:
      export:
        otlp:
          endpoint: "https://otlp.example.com:4318/v1/logs"
----

The `management.opentelemetry.logging.export.*` configuration properties can be used to configure the javadoc:io.opentelemetry.sdk.logs.export.BatchLogRecordProcessor[].
For example, to change the export interval to 15 seconds:

[configprops,yaml]
----
management:
  opentelemetry:
    logging:
      export:
        schedule-delay: "15s"
----

The `management.opentelemetry.logging.limits.*` configuration properties can be used to configure log record limits.
For example, to limit the number of attributes per log record to 64 and the maximum attribute value length to 256 characters:

[configprops,yaml]
----
management:
  opentelemetry:
    logging:
      limits:
        max-attributes: 64
        max-attribute-value-length: 256
----

If you need full control, you can register a custom javadoc:io.opentelemetry.sdk.logs.LogLimits[] bean.

NOTE: The OpenTelemetry Logback appender and Log4j appender are not part of Spring Boot.
For more details, see the https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/logback/logback-appender-1.0/library[OpenTelemetry Logback appender] or the https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/log4j/log4j-appender-2.17/library[OpenTelemetry Log4j2 appender] in the https://github.com/open-telemetry/opentelemetry-java-instrumentation[OpenTelemetry Java instrumentation GitHub repository].

TIP: You have to configure the appender in your `logback-spring.xml` or `log4j2-spring.xml` configuration to get OpenTelemetry logging working.

The `OpenTelemetryAppender` for both Logback and Log4j requires access to an javadoc:io.opentelemetry.api.OpenTelemetry[] instance to function properly.
This instance must be set programmatically during application startup, which can be done like this:

include-code::OpenTelemetryAppenderInitializer[]
