java.util.logging

Class Level

Implemented Interfaces:
Serializable
Known Direct Subclasses:
Component

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

Level(String name, int value)
Creates a logging level given a name and an integer value.
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, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

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.

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.

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 Details

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 Details

equals

public boolean equals(Object other)
Checks whether this Level's integer value is equal to that of another object.
Overrides:
equals in interface 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.
Overrides:
hashCode in interface Object

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.

toString

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

Level.java -- a class for indicating logging levels Copyright (C) 2002, 2005, 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.