Interface LoggingManager

All Known Implementing Classes:
DefautlLoggingManager

public interface LoggingManager
Due to limitations of SLF4J, we need to rely on implementations for some operations:
  • Accessing to all loggers and change their Level
  • Retrieving the log Level of a Logger

This interface is used for these operations and implementations are provided in submodules and loaded thanks to a ServiceLoader (define a file named software.amazon.lambda.powertools.logging.internal.LoggingManager in src/main/resources/META-INF/services with the qualified name of the implementation).

  • Method Summary

    Modifier and Type
    Method
    Description
    org.slf4j.event.Level
    getLogLevel(org.slf4j.Logger logger)
    Retrieve the log Level of a specific logger
    void
    setLogLevel(org.slf4j.event.Level logLevel)
    Change the log Level of all loggers (named and root)
  • Method Details

    • setLogLevel

      void setLogLevel(org.slf4j.event.Level logLevel)
      Change the log Level of all loggers (named and root)
      Parameters:
      logLevel - the log Level (slf4j) to apply
    • getLogLevel

      org.slf4j.event.Level getLogLevel(org.slf4j.Logger logger)
      Retrieve the log Level of a specific logger
      Parameters:
      logger - the logger (slf4j) for which to retrieve the log Level
      Returns:
      the Level (slf4j) of this logger. Note that SLF4J only support ERROR, WARN, INFO, DEBUG, TRACE while some frameworks may support others (OFF, FATAL, ...)