Log4j 0.9.1

org.log4j
Class Priority

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

public class Priority
extends Object

The Priority class defines the priorities that log4j recognizes.

At this time the possible priorities are EMERG, ALERT, CRIT, ERROR, WARN, NOTICE, INFO and DEBUG which correspond to the Unix Syslog priorities.

It is suggested that you only use the ERROR, WARN, INFO and DEBUG priorities.

Author:
Ceki Gülcü

Field Summary
static Priority ALERT
           
static Priority CRIT
           
static Priority DEBUG
           
static Priority EMERG
           
static Priority ERROR
           
static Priority INFO
           
static Priority NOTICE
           
protected  String strValue
           
protected  int value
           
static Priority WARN
           
 
Constructor Summary
protected Priority(int value)
          Constructor for the Priority class.
 
Method Summary
static Priority[] getAllPossiblePriorities()
          Return all possible priorities as an array of Priority objects in descending order.
 boolean isAsSevereAs(Priority r)
           
 int toInt()
           
static Priority toPriority(int i)
          Converts an integer into a Priority.
static Priority toPriority(String sArg)
          Converts a String into a Priority.
static Priority toPriority(String sArg, Priority deefault)
          Converts a String into a Priority.
 String toString()
          Return the string corresponding to the priority.
 int toSyslogInt()
          Return the equivalent syslog priority integer for this Priority instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EMERG

public static final Priority EMERG

ALERT

public static final Priority ALERT

CRIT

public static final Priority CRIT

ERROR

public static final Priority ERROR

WARN

public static final Priority WARN

NOTICE

public static final Priority NOTICE

INFO

public static final Priority INFO

DEBUG

public static final Priority DEBUG

value

protected int value

strValue

protected String strValue
Constructor Detail

Priority

protected Priority(int value)

Constructor for the Priority class.

Parameters:
value - Should be one of the priority constants.
Method Detail

getAllPossiblePriorities

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

isAsSevereAs

public final boolean isAsSevereAs(Priority r)

toInt

public final int toInt()

toPriority

public static Priority toPriority(String sArg)
Converts a String into a Priority. This method is used internally in configuration files.

If the argument is not one of "DEBUG", "INFO", ..., "EMERG" then the the default value Priority.DEBUG is returned.


toPriority

public static Priority toPriority(String sArg,
                                  Priority deefault)
Converts a String into a Priority.

It the sArg parameter cannot be converted to a priority, then the deefault parameter (specified by the caller) is returned.


toPriority

public static Priority toPriority(int i)
                           throws IllegalArgumentException
Converts an integer into a Priority. This method is used to read in a priority serialized as an interger.
Since:
0.7.5

toString

public final String toString()
Return the string corresponding to the priority.
Overrides:
toString in class Object

toSyslogInt

public int toSyslogInt()
                throws IllegalStateException
Return the equivalent syslog priority integer for this Priority instance.

Sub-classes of priority must override this method to return their own syslog equivalent, otherwise an IllegalStateException may be thrown.

Since:
0.8.5a

Log4j 0.9.1

Please notify me about new log4j releases.