Package java.util.logging
Class Level
java.lang.Object
java.util.logging.Level
- All Implemented Interfaces:
Serializable
public class Level extends Object implements Serializable
Level objects are used to indicate the level of logging. There are a
set of predefined logging levels, each associated with an integer value.
Enabling a certain logging level also enables all logging levels with larger
values.
The predefined levels in ascending order are FINEST, FINER, FINE, CONFIG, INFO, WARNING, SEVERE. There are two additional predefined levels, which are ALL and OFF. ALL indicates logging all messages, and OFF indicates logging no messages.
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description static LevelALLThe ALL level provides all logging messages.static LevelCONFIGThe CONFIG level provides static configuration messages.static LevelFINEThe FINE level provides tracing messages.static LevelFINERThe FINER level provides more detailed tracing messages.static LevelFINESTThe FINEST level provides highly detailed tracing messages.static LevelINFOThe INFO level provides informative messages.static LevelOFFThe OFF level provides no logging messages.static LevelSEVEREThe SEVERE level provides severe failure messages.static LevelWARNINGThe WARNING level provides warnings. -
Constructor Summary
Constructors Modifier Constructor Description protectedLevel(String name, int level)Constructs an instance ofLeveltaking the supplied name and level value.protectedLevel(String name, int level, String resourceBundleName)Constructs an instance ofLeveltaking the supplied name, level value and resource bundle name. -
Method Summary
Modifier and Type Method Description booleanequals(Object o)Compares twoLevelobjects for equality.StringgetLocalizedName()Gets the localized name of this level.StringgetName()Gets the name of this level.StringgetResourceBundleName()Gets the name of the resource bundle associated with this level.inthashCode()Returns the hash code of thisLevelobject.intintValue()Gets the integer value indicating this level.static Levelparse(String name)Parses a level name into aLevelobject.StringtoString()Returns the string representation of thisLevelobject.
-
Field Details
-
OFF
The OFF level provides no logging messages. -
SEVERE
The SEVERE level provides severe failure messages. -
WARNING
The WARNING level provides warnings. -
INFO
The INFO level provides informative messages. -
CONFIG
The CONFIG level provides static configuration messages. -
FINE
The FINE level provides tracing messages. -
FINER
The FINER level provides more detailed tracing messages. -
FINEST
The FINEST level provides highly detailed tracing messages. -
ALL
The ALL level provides all logging messages.
-
-
Constructor Details
-
Level
Constructs an instance ofLeveltaking the supplied name and level value.- Parameters:
name- the name of the level.level- an integer value indicating the level.- Throws:
NullPointerException- ifnameisnull.
-
Level
Constructs an instance ofLeveltaking the supplied name, level value and resource bundle name.- Parameters:
name- the name of the level.level- an integer value indicating the level.resourceBundleName- the name of the resource bundle to use.- Throws:
NullPointerException- ifnameisnull.
-
-
Method Details
-
parse
Parses a level name into aLevelobject.- Parameters:
name- the name of the desiredlevel, which cannot benull.- Returns:
- the level with the specified name.
- Throws:
NullPointerException- ifnameisnull.IllegalArgumentException- ifnameis not valid.
-
getName
Gets the name of this level.- Returns:
- this level's name.
-
getResourceBundleName
Gets the name of the resource bundle associated with this level.- Returns:
- the name of this level's resource bundle.
-
intValue
public final int intValue()Gets the integer value indicating this level.- Returns:
- this level's integer value.
-
getLocalizedName
Gets the localized name of this level. The default locale is used. If no resource bundle is associated with this level then the original level name is returned.- Returns:
- the localized name of this level.
-
equals
Compares twoLevelobjects for equality. They are considered to be equal if they have the same level value.- Overrides:
equalsin classObject- Parameters:
o- the other object to compare this level to.- Returns:
trueif this object equals to the supplied object,falseotherwise.- See Also:
Object.hashCode()
-
hashCode
public int hashCode()Returns the hash code of thisLevelobject.- Overrides:
hashCodein classObject- Returns:
- this level's hash code.
- See Also:
Object.equals(java.lang.Object)
-
toString
Returns the string representation of thisLevelobject. In this case, it is the level's name.
-