Class LevelTranslator

java.lang.Object
org.apache.logging.log4j.jul.LevelTranslator

public final class LevelTranslator extends Object
Utility class to convert between JDK Levels and Log4j 2 Levels.
Since:
2.1
  • Field Details

    • FINEST

      public static final Level FINEST
      Custom Log4j level corresponding to the Level.FINEST logging level. This maps to a level more specific than Level.TRACE.
    • CONFIG

      public static final Level CONFIG
      Custom Log4j level corresponding to the Level.CONFIG logging level. This maps to a level in between Level.INFO and Level.DEBUG.
    • LOGGER

      private static final Logger LOGGER
    • LEVEL_CONVERTER

      private static final LevelConverter LEVEL_CONVERTER
  • Constructor Details

    • LevelTranslator

      private LevelTranslator()
  • Method Details

    • toLevel

      public static Level toLevel(Level level)
      Converts a JDK logging Level to a Log4j logging Level.
      Parameters:
      level - JDK Level to convert, may be null per the JUL specification.
      Returns:
      converted Level or null
    • toJavaLevel

      public static Level toJavaLevel(Level level)
      Converts a Log4j logging Level to a JDK logging Level.
      Parameters:
      level - Log4j Level to convert.
      Returns:
      converted Level.