de.fhg.igd.logging
Class LogLevel

java.lang.Object
  extended byde.fhg.igd.logging.LogLevel
All Implemented Interfaces:
Serializable

public class LogLevel
extends Object
implements Serializable

This is the main log level class which provides a set of predefined known instances. Those serve as some sort of template from which all specific log level objects in the underlying mechanisms will be created automatically.

Priorities of predefined log levels are as follows (in descending order):

  1. OFF
  2. FATAL
  3. SEVERE
  4. ERROR
  5. WARNING
  6. INFO
  7. DEBUG
  8. TRACE
  9. ALL

Version:
"$Id: LogLevel.java 1913 2007-08-08 02:41:53Z jpeters $"
Author:
Matthias Pressfreund
See Also:
Serialized Form

Field Summary
static LogLevel ALL
          This log level is intended to be used for showing the complete logging output since it has the lowest possible priority
static LogLevel DEBUG
          This log level is intended to be used for debugging purposes, its priority is lower than those of all log levels except TRACE and ALL
static LogLevel ERROR
          This log level is intended to be used for error events that definitely will not lead into general malfunction, its priority is lower than those of SEVERE, FATAL and OFF
static LogLevel FATAL
          This log level is intended to be used for error events that definitely will lead into general malfunction, its priority is only lower than those of OFF
static LogLevel INFO
          This log level is intended to be used for information purposes, its priority is lower than those of all log levels except DEBUG, TRACE and ALL
private static Set known_
          The storage for all known log levels
protected  String name_
          The log level name
protected static LogLevel NOTIFICATION_
          A hidden log level used for notification about internal events, its priority is right below OFF
static LogLevel OFF
          This log level will turn off all logging output since it has the highest possible priority
protected  int priority_
          The log level priority
static LogLevel SEVERE
          This log level is intended to be used for error events that might lead into general malfunction, its priority is lower than those of FATAL and OFF
static LogLevel TRACE
          This log level is intended to be used for detailed debugging traces, its priority is lower than those of all other log levels except ALL
static LogLevel WARNING
          This log level is intended to be used for warning (not yet error) purposes, its priority is lower than those of all log levels except INFO, DEBUG, TRACE and ALL
 
Constructor Summary
protected LogLevel(String name, int priority)
          Create a LogLevel.
 
Method Summary
 boolean equals(Object obj)
           
static LogLevel forNotification()
          Get the LogLevel that is supposed to be used for system internal notifications only.
static Set getAll()
          Get all known LogLevel references.
 String getName()
           
 int getPriority()
           
 int hashCode()
           
 boolean isEqualTo(LogLevel level)
          Check if this LogLevel is equal to the given one.
 boolean isGreaterOrEqualTo(LogLevel level)
          Check if this LogLevel is greater or equal to the given one.
 boolean isGreaterThan(LogLevel level)
          Check if this LogLevel is greater then the given one.
 boolean isLessOrEqualTo(LogLevel level)
          Check if this LogLevel is less or equal to the given one.
 boolean isLessThan(LogLevel level)
          Check if this LogLevel is less then the given one.
private  Object readResolve()
          Serialization magic to avoid "doppelgangers" and also for performance optimization.
static LogLevel toLevel(String name)
          Get a log level by name or priority.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

known_

private static Set known_
The storage for all known log levels


ALL

public static final LogLevel ALL
This log level is intended to be used for showing the complete logging output since it has the lowest possible priority


TRACE

public static final LogLevel TRACE
This log level is intended to be used for detailed debugging traces, its priority is lower than those of all other log levels except ALL


DEBUG

public static final LogLevel DEBUG
This log level is intended to be used for debugging purposes, its priority is lower than those of all log levels except TRACE and ALL


INFO

public static final LogLevel INFO
This log level is intended to be used for information purposes, its priority is lower than those of all log levels except DEBUG, TRACE and ALL


WARNING

public static final LogLevel WARNING
This log level is intended to be used for warning (not yet error) purposes, its priority is lower than those of all log levels except INFO, DEBUG, TRACE and ALL


ERROR

public static final LogLevel ERROR
This log level is intended to be used for error events that definitely will not lead into general malfunction, its priority is lower than those of SEVERE, FATAL and OFF


SEVERE

public static final LogLevel SEVERE
This log level is intended to be used for error events that might lead into general malfunction, its priority is lower than those of FATAL and OFF


FATAL

public static final LogLevel FATAL
This log level is intended to be used for error events that definitely will lead into general malfunction, its priority is only lower than those of OFF


OFF

public static final LogLevel OFF
This log level will turn off all logging output since it has the highest possible priority


NOTIFICATION_

protected static final LogLevel NOTIFICATION_
A hidden log level used for notification about internal events, its priority is right below OFF


name_

protected String name_
The log level name


priority_

protected int priority_
The log level priority

Constructor Detail

LogLevel

protected LogLevel(String name,
                   int priority)
Create a LogLevel. The newly created instance will be added to the set of known log levels automatically (if not yet present).

Parameters:
name - The log level name
priority - The log level priority
Method Detail

getName

public String getName()

getPriority

public int getPriority()

getAll

public static Set getAll()
Get all known LogLevel references.


isGreaterThan

public boolean isGreaterThan(LogLevel level)
Check if this LogLevel is greater then the given one.

Parameters:
level - The LogLevel to be checked
Returns:
true if this LogLevel is greater than the given one
Throws:
NullPointerException - if the given object is null

isGreaterOrEqualTo

public boolean isGreaterOrEqualTo(LogLevel level)
Check if this LogLevel is greater or equal to the given one.

Parameters:
level - The LogLevel to be checked
Returns:
true if this LogLevel is greater or equal to the given one
Throws:
NullPointerException - if the given object is null

isEqualTo

public boolean isEqualTo(LogLevel level)
Check if this LogLevel is equal to the given one.

Notice: In contrary to equals(java.lang.Object), this method checks for equal priorities only.

Parameters:
level - The LogLevel to be checked
Returns:
true if this LogLevel is equal to the given one
Throws:
NullPointerException - if the given object is null

isLessOrEqualTo

public boolean isLessOrEqualTo(LogLevel level)
Check if this LogLevel is less or equal to the given one.

Parameters:
level - The LogLevel to be checked
Returns:
true if this LogLevel is greater than the given one
Throws:
NullPointerException - if the given object is null

isLessThan

public boolean isLessThan(LogLevel level)
Check if this LogLevel is less then the given one.

Parameters:
level - The LogLevel to be checked
Returns:
true if this LogLevel is greater than the given one
Throws:
NullPointerException - if the given object is null

toLevel

public static LogLevel toLevel(String name)
Get a log level by name or priority.

Parameters:
name - The name or priority of the requested log level
Returns:
The requested log level or null if the given parameter could neither identified as name nor as priority of a known log level

forNotification

public static LogLevel forNotification()
Get the LogLevel that is supposed to be used for system internal notifications only. It is currently used by the Asynchronous Message Dispatching mechanism to notify users about discarded messages.

Returns:
The notification log level
See Also:
AbstractAsynchronousMessageDispatcher

equals

public boolean equals(Object obj)

hashCode

public int hashCode()

toString

public String toString()

readResolve

private Object readResolve()
                    throws InvalidObjectException
Serialization magic to avoid "doppelgangers" and also for performance optimization.

Throws:
InvalidObjectException - if the deserialized LogLevel does not exist


Copyright © Fraunhofer Gesellschaft. All Rights Reserved.