org.opends.server.loggers
Class LogLevel

java.lang.Object
  extended by org.opends.server.loggers.LogLevel
Direct Known Subclasses:
DebugLogLevel

public class LogLevel
extends java.lang.Object

The Level class defines a set of standard logging levels that can be used to control logging output. The logging Level objects are ordered and are specified by ordered integers. Enabling logging at a given level also enables logging at all higher levels.


Field Summary
static LogLevel ALL
          ALL indicates that all messages should be logged.
static LogLevel DISABLED
          OFF is a special level that can be used to turn off logging.
 
Constructor Summary
protected LogLevel(java.lang.String name, int value)
          Create a named Level with a given integer value.
 
Method Summary
 boolean equals(java.lang.Object ox)
          Compare two objects for value equality.
static java.util.HashSet<java.lang.String> getLevelStrings()
          Returns the string representations of all the levels.
 java.lang.String getName()
          Return the non-localized string name of the Level.
 int hashCode()
          Retrives the hashcode for this log level.
 int intValue()
          Get the integer value for this level.
static LogLevel parse(java.lang.String name)
          Parse a level name string into a LogLevel.
 java.lang.String toString()
          Retrieve the string reprentation of this log level.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DISABLED

public static final LogLevel DISABLED
OFF is a special level that can be used to turn off logging. This level is initialized to Integer.MAX_VALUE.


ALL

public static final LogLevel ALL
ALL indicates that all messages should be logged. This level is initialized to Integer.MIN_VALUE.

Constructor Detail

LogLevel

protected LogLevel(java.lang.String name,
                   int value)
Create a named Level with a given integer value.

Note that this constructor is "protected" to allow subclassing.

Parameters:
name - the name of the Level, for example "SEVERE".
value - an integer value for the level.
Method Detail

getName

public java.lang.String getName()
Return the non-localized string name of the Level.

Returns:
non-localized name

toString

public final java.lang.String toString()
Retrieve the string reprentation of this log level.

Overrides:
toString in class java.lang.Object
Returns:
the non-localized name of the Level, for example "INFO".

intValue

public final int intValue()
Get the integer value for this level. This integer value can be used for efficient ordering comparisons between Level objects.

Returns:
the integer value for this level.

parse

public static LogLevel parse(java.lang.String name)
                      throws java.lang.IllegalArgumentException
Parse a level name string into a LogLevel.

The argument string may consist of either a level name or an integer value.

For example:

Parameters:
name - string to be parsed
Returns:
The parsed value. Passing an integer that corresponds to a known name (eg 700) will return the associated name (eg CONFIG). Passing an integer that does not (eg 1) will return a new level name initialized to that value.
Throws:
java.lang.IllegalArgumentException - if the value is not valid. Valid values are integers between Integer.MIN_VALUE and Integer.MAX_VALUE, and all known level names. Known names are the levels defined by this class (i.e. FINE, FINER, FINEST), or created by this class with appropriate package access, or new levels defined or created by subclasses.

equals

public boolean equals(java.lang.Object ox)
Compare two objects for value equality.

Overrides:
equals in class java.lang.Object
Parameters:
ox - the LogLevel object to test.
Returns:
true if and only if the two objects have the same level value.

hashCode

public int hashCode()
Retrives the hashcode for this log level. It is just the integer value.

Overrides:
hashCode in class java.lang.Object
Returns:
the hashCode for this log level.

getLevelStrings

public static java.util.HashSet<java.lang.String> getLevelStrings()
Returns the string representations of all the levels. All strings will be in lower case.

Returns:
The string representations of the levels in lower case.