Package org.apache.log4j
Class Level
- java.lang.Object
-
- org.apache.log4j.Priority
-
- org.apache.log4j.Level
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
UtilLoggingLevel
public class Level extends Priority implements java.io.Serializable
Defines the minimum set of levels recognized by the system, that isOFF
,FATAL
,ERROR
,WARN
,INFO
,DEBUG
andALL
.The
Level
class may be subclassed to define a larger level set.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static Level
ALL
TheALL
has the lowest possible rank and is intended to turn on all logging.static Level
DEBUG
TheDEBUG
Level designates fine-grained informational events that are most useful to debug an application.static Level
ERROR
TheERROR
level designates error events that might still allow the application to continue running.static Level
FATAL
TheFATAL
level designates very severe error events that will presumably lead the application to abort.static Level
INFO
TheINFO
level designates informational messages that highlight the progress of the application at coarse-grained level.static Level
OFF
TheOFF
has the highest possible rank and is intended to turn off logging.private static long
serialVersionUID
Serialization version id.static Level
TRACE
TheTRACE
Level designates finer-grained informational events than theDEBUG
level.static int
TRACE_INT
TRACE level integer value.static Level
WARN
TheWARN
level designates potentially harmful situations.
-
Constructor Summary
Constructors Modifier Constructor Description protected
Level(int level, java.lang.String levelStr, int syslogEquivalent)
Instantiate a Level object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
readObject(java.io.ObjectInputStream s)
Custom deserialization of Level.protected java.lang.Object
readResolve()
Resolved deserialized level to one of the stock instances.static Level
toLevel(int val)
Convert an integer passed as argument to a level.static Level
toLevel(int val, Level defaultLevel)
Convert an integer passed as argument to a level.static Level
toLevel(java.lang.String sArg)
Convert the string passed as argument to a level.static Level
toLevel(java.lang.String sArg, Level defaultLevel)
Convert the string passed as argument to a level.private void
writeObject(java.io.ObjectOutputStream s)
Serialize level.-
Methods inherited from class org.apache.log4j.Priority
equals, getAllPossiblePriorities, getSyslogEquivalent, hashCode, isGreaterOrEqual, toInt, toPriority, toPriority, toPriority, toPriority, toString
-
-
-
-
Field Detail
-
TRACE_INT
public static final int TRACE_INT
TRACE level integer value.- Since:
- 1.2.12
- See Also:
- Constant Field Values
-
OFF
public static final Level OFF
TheOFF
has the highest possible rank and is intended to turn off logging.
-
FATAL
public static final Level FATAL
TheFATAL
level designates very severe error events that will presumably lead the application to abort.
-
ERROR
public static final Level ERROR
TheERROR
level designates error events that might still allow the application to continue running.
-
WARN
public static final Level WARN
TheWARN
level designates potentially harmful situations.
-
INFO
public static final Level INFO
TheINFO
level designates informational messages that highlight the progress of the application at coarse-grained level.
-
DEBUG
public static final Level DEBUG
TheDEBUG
Level designates fine-grained informational events that are most useful to debug an application.
-
TRACE
public static final Level TRACE
TheTRACE
Level designates finer-grained informational events than theDEBUG
level.
-
ALL
public static final Level ALL
TheALL
has the lowest possible rank and is intended to turn on all logging.
-
serialVersionUID
private static final long serialVersionUID
Serialization version id.- See Also:
- Constant Field Values
-
-
Method Detail
-
toLevel
public static Level toLevel(java.lang.String sArg)
Convert the string passed as argument to a level. If the conversion fails, then this method returnsDEBUG
.- Parameters:
sArg
- The level name.- Returns:
- The Level.
-
toLevel
public static Level toLevel(int val)
Convert an integer passed as argument to a level. If the conversion fails, then this method returnsDEBUG
.- Parameters:
val
- The integer value of the Level.- Returns:
- The Level.
-
toLevel
public static Level toLevel(int val, Level defaultLevel)
Convert an integer passed as argument to a level. If the conversion fails, then this method returns the specified default.- Parameters:
val
- The integer value of the Level.defaultLevel
- the default level if the integer doesn't match.- Returns:
- The matching Level.
-
toLevel
public static Level toLevel(java.lang.String sArg, Level defaultLevel)
Convert the string passed as argument to a level. If the conversion fails, then this method returns the value ofdefaultLevel
.- Parameters:
sArg
- The name of the Level.defaultLevel
- The default Level to use.- Returns:
- the matching Level.
-
readObject
private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, java.lang.ClassNotFoundException
Custom deserialization of Level.- Parameters:
s
- serialization stream.- Throws:
java.io.IOException
- if IO exception.java.lang.ClassNotFoundException
- if class not found.
-
writeObject
private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException
Serialize level.- Parameters:
s
- serialization stream.- Throws:
java.io.IOException
- if exception during serialization.
-
readResolve
protected java.lang.Object readResolve() throws java.io.ObjectStreamException
Resolved deserialized level to one of the stock instances. May be overridden in classes derived from Level.- Returns:
- resolved object.
- Throws:
java.io.ObjectStreamException
- if exception during resolution.
-
-