java.util.logging

Class Level

public class Level extends Object implements Serializable

A class for indicating logging levels. A number of commonly used levels is pre-defined (such as java.util.logging.Level.INFO), and applications should utilize those whenever possible. For specialized purposes, however, applications can sub-class Level in order to define custom logging levels.
Field Summary
static LevelALL
The ALL level is used as a threshold for filtering log records, meaning that every message should be logged.
static LevelCONFIG
Log records whose level is CONFIG are used for describing the static configuration, for example the windowing environment, the operating system version, etc.
static LevelFINE
Log records whose level is FINE are typically used for messages that are relevant for developers using the component generating log messages.
static LevelFINER
Log records whose level is FINER are intended for rather detailed tracing, for example entering a method, returning from a method, or throwing an exception.
static LevelFINEST
Log records whose level is FINEST are used for highly detailed tracing, for example to indicate that a certain point inside the body of a method has been reached.
static LevelINFO
Log records whose level is INFO are used in purely informational situations that do not constitute serious errors or potential problems.
static LevelOFF
The OFF level is used as a threshold for filtering log records, meaning that no message should be logged.
static LevelSEVERE
Log records whose level is SEVERE indicate a serious failure that prevents normal program execution.
static LevelWARNING
Log records whose level is WARNING indicate a potential problem that does not prevent normal program execution.
Constructor Summary
protected Level(String name, int value)
Creates a logging level given a name and an integer value.
protected Level(String name, int value, String resourceBundleName)
Create a logging level given a name, an integer value and a name of a resource bundle for localizing the level name.
Method Summary
booleanequals(Object other)
Checks whether this Level's integer value is equal to that of another object.
StringgetLocalizedName()
Returns the name of the Level after localizing it, for example "WARNUNG".
StringgetName()
Returns the name of the Level without localizing it, for example "WARNING".
StringgetResourceBundleName()
Returns the name of the resource bundle used for localizing the level name.
inthashCode()
Returns a hash code for this Level which is based on its numeric value.
intintValue()
Returns the integer value of the Level.
static Levelparse(String name)
Returns one of the standard Levels given either its name or its integer value.
StringtoString()
Returns the name of the Level without localizing it, for example "WARNING".

Field Detail

ALL

public static final Level ALL
The ALL level is used as a threshold for filtering log records, meaning that every message should be logged.

See Also: setLevel

CONFIG

public static final Level CONFIG
Log records whose level is CONFIG are used for describing the static configuration, for example the windowing environment, the operating system version, etc.

FINE

public static final Level FINE
Log records whose level is FINE are typically used for messages that are relevant for developers using the component generating log messages. Examples include minor, recoverable failures, or possible inefficiencies.

FINER

public static final Level FINER
Log records whose level is FINER are intended for rather detailed tracing, for example entering a method, returning from a method, or throwing an exception.

FINEST

public static final Level FINEST
Log records whose level is FINEST are used for highly detailed tracing, for example to indicate that a certain point inside the body of a method has been reached.

INFO

public static final Level INFO
Log records whose level is INFO are used in purely informational situations that do not constitute serious errors or potential problems. In the default logging configuration, INFO messages will be written to the system console. For this reason, the INFO level should be used only for messages that are important to end users and system administrators. Messages at this level should be understandable to an inexperienced, non-technical user.

OFF

public static final Level OFF
The OFF level is used as a threshold for filtering log records, meaning that no message should be logged.

See Also: setLevel

SEVERE

public static final Level SEVERE
Log records whose level is SEVERE indicate a serious failure that prevents normal program execution. Messages at this level should be understandable to an inexperienced, non-technical end user. Ideally, they explain in simple words what actions the user can take in order to resolve the problem.

WARNING

public static final Level WARNING
Log records whose level is WARNING indicate a potential problem that does not prevent normal program execution. Messages at this level should be understandable to an inexperienced, non-technical end user. Ideally, they explain in simple words what actions the user can take in order to resolve the problem.

Constructor Detail

Level

protected Level(String name, int value)
Creates a logging level given a name and an integer value. It rarely is necessary to create custom levels, as most applications should be well served with one of the standard levels such as Level.CONFIG, Level.INFO, or Level.FINE.

Parameters: name the name of the level. value the integer value of the level. Please note that the JavaTM Logging API does not specify integer values for standard levels (such as Level.FINE). Therefore, a custom level should pass an integer value that is calculated at run-time, e.g. (Level.FINE.intValue() + Level.CONFIG.intValue()) / 2 for a level between FINE and CONFIG.

Level

protected Level(String name, int value, String resourceBundleName)
Create a logging level given a name, an integer value and a name of a resource bundle for localizing the level name. It rarely is necessary to create custom levels, as most applications should be well served with one of the standard levels such as Level.CONFIG, Level.INFO, or Level.FINE.

Parameters: name the name of the level. value the integer value of the level. Please note that the JavaTM Logging API does not specify integer values for standard levels (such as Level.FINE). Therefore, a custom level should pass an integer value that is calculated at run-time, e.g. (Level.FINE.intValue() + Level.CONFIG.intValue()) / 2 for a level between FINE and CONFIG. resourceBundleName the name of a resource bundle for localizing the level name, or null if the name does not need to be localized.

Method Detail

equals

public boolean equals(Object other)
Checks whether this Level's integer value is equal to that of another object.

Returns: true if other is an instance of java.util.logging.Level and has the same integer value, false otherwise.

getLocalizedName

public String getLocalizedName()
Returns the name of the Level after localizing it, for example "WARNUNG".

getName

public String getName()
Returns the name of the Level without localizing it, for example "WARNING".

getResourceBundleName

public String getResourceBundleName()
Returns the name of the resource bundle used for localizing the level name.

Returns: the name of the resource bundle used for localizing the level name, or null if the name does not undergo localization.

hashCode

public int hashCode()
Returns a hash code for this Level which is based on its numeric value.

intValue

public final int intValue()
Returns the integer value of the Level.

parse

public static Level parse(String name)
Returns one of the standard Levels given either its name or its integer value. Custom subclasses of Level will not be returned by this method.

Throws: IllegalArgumentException if name is neither the name nor the integer value of one of the pre-defined standard logging levels. NullPointerException if name is null.

toString

public final String toString()
Returns the name of the Level without localizing it, for example "WARNING".