Class LevelTranslator


  • public final class LevelTranslator
    extends java.lang.Object
    Utility class to convert between JDK Levels and Log4j 2 Levels.
    Since:
    2.1
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private LevelTranslator()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.logging.Level toJavaLevel​(Level level)
      Converts a Log4j logging Level to a JDK logging Level.
      static Level toLevel​(java.util.logging.Level level)
      Converts a JDK logging Level to a Log4j logging Level.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • 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 Detail

      • LevelTranslator

        private LevelTranslator()
    • Method Detail

      • toLevel

        public static Level toLevel​(java.util.logging.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 java.util.logging.Level toJavaLevel​(Level level)
        Converts a Log4j logging Level to a JDK logging Level.
        Parameters:
        level - Log4j Level to convert.
        Returns:
        converted Level.