org.apache.logging.log4j
Enum Level

java.lang.Object
  extended by java.lang.Enum<Level>
      extended by org.apache.logging.log4j.Level
All Implemented Interfaces:
Serializable, Comparable<Level>

public enum Level
extends Enum<Level>

Levels used for identifying the severity of an event. Levels are organized from most specific to least:

Typically, configuring a level in a filter or on a logger will cause logging events of that level and those that are more specific to pass through the filter. A special level, ALL, is guaranteed to capture all levels when used in logging configurations.


Enum Constant Summary
ALL
          All events should be logged.
DEBUG
          A general debugging event.
ERROR
          An error in the application, possibly recoverable.
FATAL
          A severe error that will prevent the application from continuing.
INFO
          An event for informational purposes.
OFF
          No events will be logged.
TRACE
          A fine-grained debug message, typically capturing the flow through the application.
WARN
          An event that might possible lead to an error.
 
Method Summary
 int intLevel()
          Returns the integer value of the Level.
 boolean isAtLeastAsSpecificAs(int level)
          Compares this level against the level passed as an argument and returns true if this level is the same or more specific.
 boolean isAtLeastAsSpecificAs(Level level)
          Compares this level against the level passed as an argument and returns true if this level is the same or more specific.
 boolean lessOrEqual(int level)
          Compares the specified Level against this one.
 boolean lessOrEqual(Level level)
          Compares the specified Level against this one.
static Level toLevel(String sArg)
          Converts the string passed as argument to a level.
static Level toLevel(String name, Level defaultLevel)
          Converts the string passed as argument to a level.
static Level valueOf(String name)
          Returns the enum constant of this type with the specified name.
static Level[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

OFF

public static final Level OFF
No events will be logged.


FATAL

public static final Level FATAL
A severe error that will prevent the application from continuing.


ERROR

public static final Level ERROR
An error in the application, possibly recoverable.


WARN

public static final Level WARN
An event that might possible lead to an error.


INFO

public static final Level INFO
An event for informational purposes.


DEBUG

public static final Level DEBUG
A general debugging event.


TRACE

public static final Level TRACE
A fine-grained debug message, typically capturing the flow through the application.


ALL

public static final Level ALL
All events should be logged.

Method Detail

values

public static Level[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (Level c : Level.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static Level valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

toLevel

public static Level toLevel(String sArg)
Converts the string passed as argument to a level. If the conversion fails, then this method returns DEBUG.

Parameters:
sArg - The name of the desired Level.
Returns:
The Level associated with the String.

toLevel

public static Level toLevel(String name,
                            Level defaultLevel)
Converts the string passed as argument to a level. If the conversion fails, then this method returns the value of defaultLevel.

Parameters:
name - The name of the desired Level.
defaultLevel - The Level to use if the String is invalid.
Returns:
The Level associated with the String.

isAtLeastAsSpecificAs

public boolean isAtLeastAsSpecificAs(Level level)
Compares this level against the level passed as an argument and returns true if this level is the same or more specific.

Parameters:
level - The level to check.
Returns:
True if the passed Level is more specific or the same as this Level.

isAtLeastAsSpecificAs

public boolean isAtLeastAsSpecificAs(int level)
Compares this level against the level passed as an argument and returns true if this level is the same or more specific.

Parameters:
level - The level to check.
Returns:
True if the passed Level is more specific or the same as this Level.

lessOrEqual

public boolean lessOrEqual(Level level)
Compares the specified Level against this one.

Parameters:
level - The level to check.
Returns:
True if the passed Level is more specific or the same as this Level.

lessOrEqual

public boolean lessOrEqual(int level)
Compares the specified Level against this one.

Parameters:
level - The level to check.
Returns:
True if the passed Level is more specific or the same as this Level.

intLevel

public int intLevel()
Returns the integer value of the Level.

Returns:
the integer value of the Level.


Copyright © 1999-2012 Apache Software Foundation. All Rights Reserved. Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, and the Apache Logging project logo are trademarks of The Apache Software Foundation.