Class Level


  • public final class Level
    extends Object
    The Level class defines a set of standard logging levels that can be used to control logging output. Enabling logging at a given level also enables logging at all higher levels.

    The levels in descending order are:

    • ERROR
    • WARNING
    • INFO
    • DEBUG

    This class cannot be instantiated or subclassed by clients.

    See Also:
    Logger.setLevel(Level)
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static Level DEBUG
      DEBUG level is used to assist in debugging problems that may be associated with particular configurations.
      static Level ERROR
      ERROR level should describe events that are of considerable importance and which will prevent normal program execution.
      static Level INFO
      INFO level should only be used for reasonably significant messages that will make sense to end users and system admins.
      static Level WARNING
      WARNING level should describe events that will be of interest to end users or system managers, or which indicate potential problems.
    • Field Detail

      • DEBUG

        public static final Level DEBUG
        DEBUG level is used to assist in debugging problems that may be associated with particular configurations.
      • INFO

        public static final Level INFO
        INFO level should only be used for reasonably significant messages that will make sense to end users and system admins.
      • WARNING

        public static final Level WARNING
        WARNING level should describe events that will be of interest to end users or system managers, or which indicate potential problems.
      • ERROR

        public static final Level ERROR
        ERROR level should describe events that are of considerable importance and which will prevent normal program execution.
    • Method Detail

      • compareTo

        public int compareTo​(Level level)

        Compares this level with the specified level for order. Returns a negative integer, zero, or a positive integer as this level is less than, equal to, or greater than the specified level.

        The lowest level is DEBUG, the highest is ERROR

        Parameters:
        level - the level to compare with.
        Returns:
        a negative integer, zero, or a positive integer as this level is less than, equal to, or greater than the specified level.
      • isDebug

        public boolean isDebug()
        Returns true if this level is DEBUG.
        Returns:
        true if this level is DEBUG, false otherwise.
      • isInfo

        public boolean isInfo()
        Returns true if this level is INFO.
        Returns:
        true if this level is INFO, false otherwise.
      • isWarning

        public boolean isWarning()
        Returns true if this level is WARNING.
        Returns:
        true if this level is WARNING, false otherwise.
      • isError

        public boolean isError()
        Returns true if this level is ERROR.
        Returns:
        true if this level is ERROR, false otherwise.
      • toString

        public String toString()
        Returns a String representation of this level.
        Overrides:
        toString in class Object
        Returns:
        the level as a String.