java.util.logging
Class Level

java.lang.Object
  extended by java.util.logging.Level
All Implemented Interfaces:
Serializable

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.

See Also:
Serialized Form

Field Summary
static Level ALL
          The ALL level is used as a threshold for filtering log records, meaning that every message should be logged.
static 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.
static Level FINE
          Log records whose level is FINE are typically used for messages that are relevant for developers using the component generating log messages.
static 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.
static 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.
static Level INFO
          Log records whose level is INFO are used in purely informational situations that do not constitute serious errors or potential problems.
static Level OFF
          The OFF level is used as a threshold for filtering log records, meaning that no message should be logged.
static Level SEVERE
          Log records whose level is SEVERE indicate a serious failure that prevents normal program execution.
static Level WARNING
          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
 boolean equals(Object other)
          Checks whether this Level's integer value is equal to that of another object.
 String getLocalizedName()
          Returns the name of the Level after localizing it, for example "WARNUNG".
 String getName()
          Returns the name of the Level without localizing it, for example "WARNING".
 String getResourceBundleName()
          Returns the name of the resource bundle used for localizing the level name.
 int hashCode()
          Returns a hash code for this Level which is based on its numeric value.
 int intValue()
          Returns the integer value of the Level.
static Level parse(String name)
          Returns one of the standard Levels given either its name or its integer value.
 String toString()
          Returns the name of the Level without localizing it, for example "WARNING".
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

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:
Logger.setLevel(java.util.logging.Level)

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.


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.


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.


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:
Logger.setLevel(java.util.logging.Level)
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

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.

getName

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


getLocalizedName

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


toString

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

Overrides:
toString in class Object
Returns:
the String representing this Object, which may be null
See Also:
Object.getClass(), Object.hashCode(), Class.getName(), Integer.toHexString(int)

intValue

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


parse

public static Level parse(String name)
                   throws IllegalArgumentException
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.

equals

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

Overrides:
equals in class Object
Parameters:
other - the Object to compare to
Returns:
true if other is an instance of java.util.logging.Level and has the same integer value, false otherwise.
See Also:
Object.hashCode()

hashCode

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

Overrides:
hashCode in class Object
Returns:
the hash code for this Object
See Also:
Object.equals(Object), System.identityHashCode(Object)