Log4j 1.1.3

org.apache.log4j
Class Priority

java.lang.Object
  |
  +--org.apache.log4j.Priority
Direct Known Subclasses:
XPriority

public class Priority
extends Object

Defines the minimum set of priorities recognized by the system, that is FATAL, ERROR, WARN, INFO and DEBUG.

The Priority class may be subclassed to define a larger priority set.

Author:
Ceki Gülcü

Field Summary
static Priority DEBUG
          The DEBUG priority designates fine-grained informational events that are most useful to debug an application.
static int DEBUG_INT
           
static Priority ERROR
          The ERROR priority designates error events that might still allow the application to continue running.
static int ERROR_INT
           
static Priority FATAL
          The FATAL priority designates very severe error events that will presumably lead the application to abort.
static int FATAL_INT
           
static Priority INFO
          The INFO priority designates informational messages that highlight the progress of the application at coarse-grained level.
static int INFO_INT
           
static Priority WARN
          The WARN priority designates potentially harmful situations.
static int WARN_INT
           
 
Constructor Summary
protected Priority(int level, String levelStr, int syslogEquivalent)
          Instantiate a priority object.
 
Method Summary
static Priority[] getAllPossiblePriorities()
          Return all possible priorities as an array of Priority objects in descending order.
 int getSyslogEquivalent()
          Return the syslog equivalent of this priority as an integer.
 boolean isGreaterOrEqual(Priority r)
          Returns true if this priority has a higher or equal priority than the priority passed as argument, false otherwise.
 int toInt()
          Returns the integer representation of this priority.
static Priority toPriority(int val)
          Convert an integer passed as argument to a priority.
static Priority toPriority(int val, Priority defaultPriority)
          Convert an integer passed as argument to a priority.
static Priority toPriority(String sArg)
          Convert the string passed as argument to a priority.
static Priority toPriority(String sArg, Priority defaultPriority)
          Convert the string passed as argument to a priority.
 String toString()
          Returns the string representation of this priority.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FATAL_INT

public static final int FATAL_INT

ERROR_INT

public static final int ERROR_INT

WARN_INT

public static final int WARN_INT

INFO_INT

public static final int INFO_INT

DEBUG_INT

public static final int DEBUG_INT

FATAL

public static final Priority FATAL
The FATAL priority designates very severe error events that will presumably lead the application to abort.

ERROR

public static final Priority ERROR
The ERROR priority designates error events that might still allow the application to continue running.

WARN

public static final Priority WARN
The WARN priority designates potentially harmful situations.

INFO

public static final Priority INFO
The INFO priority designates informational messages that highlight the progress of the application at coarse-grained level.

DEBUG

public static final Priority DEBUG
The DEBUG priority designates fine-grained informational events that are most useful to debug an application.
Constructor Detail

Priority

protected Priority(int level,
                   String levelStr,
                   int syslogEquivalent)
Instantiate a priority object.
Method Detail

getSyslogEquivalent

public final int getSyslogEquivalent()
Return the syslog equivalent of this priority as an integer.

toString

public final String toString()
Returns the string representation of this priority.
Overrides:
toString in class Object

toInt

public final int toInt()
Returns the integer representation of this priority.

isGreaterOrEqual

public boolean isGreaterOrEqual(Priority r)
Returns true if this priority has a higher or equal priority than the priority passed as argument, false otherwise.

You should think twice before overriding the default implementation of isGreaterOrEqual method.


getAllPossiblePriorities

public static Priority[] getAllPossiblePriorities()
Return all possible priorities as an array of Priority objects in descending order.

toPriority

public static Priority toPriority(String sArg)
Convert the string passed as argument to a priority. If the conversion fails, then this method returns DEBUG.

toPriority

public static Priority toPriority(int val)
Convert an integer passed as argument to a priority. If the conversion fails, then this method returns DEBUG.

toPriority

public static Priority toPriority(int val,
                                  Priority defaultPriority)
Convert an integer passed as argument to a priority. If the conversion fails, then this method returns the specified default.

toPriority

public static Priority toPriority(String sArg,
                                  Priority defaultPriority)
Convert the string passed as argument to a priority. If the conversion fails, then this method returns the value of defaultPriority.

Log4j 1.1.3

Please notify me about new log4j releases.