| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.log5j.Level
public final class Level
A logging level to compare when deciding whether to log a message. All logging levels can be represented as either a String or an int value.
Higher priority logging levels have lower values. The standard logging levels have the following values:
| FATAL | : | 20 | 
| ERROR | : | 30 | 
| WARN | : | 40 | 
| INFO | : | 50 | 
| DEBUG | : | 60 | 
| TRACE | : | 70 | 
ALL has a value of 100 and OFF has a value of 0 for obvious reasons.
Most programmers won't use this class directly but will set logging levels using a configuration class or file. A few may wish to implement custom logging levels if they need finer control than that afforded by the standard levels.
 See the javadocs for the Level(String, int) constructor to find out
 how to create custome logging levels.
| Field Summary | |
|---|---|
| static Level | ALLUse this level to show all logging. | 
| static Level | DEBUGLog debug messages and above | 
| static Level | ERRORLog error messages and above. | 
| static Level | FATALLog only fatal error messages. | 
| static Level | INFOLog info messages and above. | 
| static Level | OFFUse this level to turn off all logging. | 
| static Level | TRACELog trace messages and above | 
| static Level | WARNLog warning messages and above. | 
| Constructor Summary | |
|---|---|
| Level(java.lang.String name,
      int value)Create a new logging level with the given name and int value between 1 and 100 inclusive. | |
| Method Summary | |
|---|---|
|  int | compareTo(Level other)Compare this logging level with another. | 
|  boolean | equals(Level other)Returns true if the other Level has the same int value as this logging level. | 
|  boolean | equals(java.lang.Object o)Returns true if the argument o is a Level and has the same int value as this logging level. | 
|  int | hashCode()The hash code of a Level is its int value. | 
|  java.lang.String | toString()Returns String representation of this logging level, which is the same as the name. | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, finalize, getClass, notify, notifyAll, wait, wait, wait | 
| Field Detail | 
|---|
public static final Level ALL
public static final Level TRACE
public static final Level DEBUG
public static final Level INFO
public static final Level WARN
public static final Level ERROR
public static final Level FATAL
public static final Level OFF
| Constructor Detail | 
|---|
public Level(java.lang.String name,
             int value)
Levels must be created in a log5j config class.
 The log5j config class must extend Properties and the
 new Levels be instantiated just once in a parameterless
 constructor. For example,
 
 
 public class MyLog5jConfig extends Properties {
 
     public MyLog5jConfig() {
 
         new Level("MY_LOGGING_LEVEL", 55);
         setProperty("org.mycompany.MyClass.level", "MY_LOGGING_LEVEL");
     }
 }
 
 
 Set the system property log5j.class to the fully qualified
 name of your config class to ensure that it is loaded during logging
 initialisation.
value - an int value for comparison with other logging levels; 1
            <= value <= 100name - the String representation of this logging level| Method Detail | 
|---|
public int compareTo(Level other)
compareTo in interface java.lang.Comparable<Level>other - the other logging level
public boolean equals(Level other)
other - another Level
public boolean equals(java.lang.Object o)
equals in class java.lang.Objecto - an Object
public int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||