FileDocCategorySizeDatePackage
Level.javaAPI DocApache log4j 1.2.156794Sat Aug 25 00:09:42 BST 2007org.apache.log4j

Level

public class Level extends Priority implements Serializable
Defines the minimum set of levels recognized by the system, that is OFF, FATAL, ERROR, WARN, INFODEBUG and ALL.

The Level class may be subclassed to define a larger level set.

author
Ceki Gülcü

Fields Summary
public static final int
TRACE_INT
TRACE level integer value.
public static final Level
OFF
The OFF has the highest possible rank and is intended to turn off logging.
public static final Level
FATAL
The FATAL level designates very severe error events that will presumably lead the application to abort.
public static final Level
ERROR
The ERROR level designates error events that might still allow the application to continue running.
public static final Level
WARN
The WARN level designates potentially harmful situations.
public static final Level
INFO
The INFO level designates informational messages that highlight the progress of the application at coarse-grained level.
public static final Level
DEBUG
The DEBUG Level designates fine-grained informational events that are most useful to debug an application.
public static final Level
TRACE
The TRACE Level designates finer-grained informational events than the DEBUG
public static final Level
ALL
The ALL has the lowest possible rank and is intended to turn on all logging.
static final long
serialVersionUID
Serialization version id.
Constructors Summary
protected Level(int level, String levelStr, int syslogEquivalent)
Instantiate a Level object.


             
  
        
    super(level, levelStr, syslogEquivalent);
  
Methods Summary
private voidreadObject(java.io.ObjectInputStream s)
Custom deserialization of Level.

param
s serialization stream.
throws
IOException if IO exception.
throws
ClassNotFoundException if class not found.

      s.defaultReadObject();
      level = s.readInt();
      syslogEquivalent = s.readInt();
      levelStr = s.readUTF();
      if (levelStr == null) {
          levelStr = "";
      }
    
private java.lang.ObjectreadResolve()
Resolved deserialized level to one of the stock instances. May be overriden in classes derived from Level.

return
resolved object.
throws
ObjectStreamException if exception during resolution.

        //
        //  if the deserizalized object is exactly an instance of Level
        //
        if (getClass() == Level.class) {
            return toLevel(level);
        }
        //
        //   extension of Level can't substitute stock item
        //
        return this;
    
public static org.apache.log4j.LeveltoLevel(java.lang.String sArg)
Convert the string passed as argument to a level. If the conversion fails, then this method returns {@link #DEBUG}.

    return (Level) toLevel(sArg, Level.DEBUG);
  
public static org.apache.log4j.LeveltoLevel(int val)
Convert an integer passed as argument to a level. If the conversion fails, then this method returns {@link #DEBUG}.

    return (Level) toLevel(val, Level.DEBUG);
  
public static org.apache.log4j.LeveltoLevel(int val, org.apache.log4j.Level defaultLevel)
Convert an integer passed as argument to a level. If the conversion fails, then this method returns the specified default.

    switch(val) {
    case ALL_INT: return ALL;
    case DEBUG_INT: return Level.DEBUG;
    case INFO_INT: return Level.INFO;
    case WARN_INT: return Level.WARN;
    case ERROR_INT: return Level.ERROR;
    case FATAL_INT: return Level.FATAL;
    case OFF_INT: return OFF;
    case TRACE_INT: return Level.TRACE;
    default: return defaultLevel;
    }
  
public static org.apache.log4j.LeveltoLevel(java.lang.String sArg, org.apache.log4j.Level defaultLevel)
Convert the string passed as argument to a level. If the conversion fails, then this method returns the value of defaultLevel.

                  
    if(sArg == null)
       return defaultLevel;
    
    String s = sArg.toUpperCase();

    if(s.equals("ALL")) return Level.ALL; 
    if(s.equals("DEBUG")) return Level.DEBUG; 
    if(s.equals("INFO"))  return Level.INFO;
    if(s.equals("WARN"))  return Level.WARN;  
    if(s.equals("ERROR")) return Level.ERROR;
    if(s.equals("FATAL")) return Level.FATAL;
    if(s.equals("OFF")) return Level.OFF;
    if(s.equals("TRACE")) return Level.TRACE;
    //
    //   For Turkish i problem, see bug 40937
    //
    if(s.equals("\u0130NFO")) return Level.INFO;
    return defaultLevel;
  
private voidwriteObject(java.io.ObjectOutputStream s)
Serialize level.

param
s serialization stream.
throws
IOException if exception during serialization.

        s.defaultWriteObject();
        s.writeInt(level);
        s.writeInt(syslogEquivalent);
        s.writeUTF(levelStr);