de.uka.ipd.consensus.foundation.logging
Interface LoggingManager

All Superinterfaces:
ConsensusFoundationModule
All Known Implementing Classes:
LoggingManagerImpl

public interface LoggingManager
extends ConsensusFoundationModule

The LoggingManager is used by all other components to log debug and information messages. Furthermore, an implementation can register itself as a listener on other components and log their actions automatically.

The LoggingManager implementation can be configured with the key cf.loggingmanager in the ConsensusFoundation.properties configuration file. It's a core component and not optional.

The implementation is loaded by the ConsensusFoundation constructor. For successful instantiation, the LoggingManager implementation must provide a default constructor without arguments.

Version:
2006-06-14
Author:
Thomas Much
See Also:
ConsensusFoundation

Field Summary
static int LEVEL_ALL
          The loglevel at which all messages are logged.
static int LEVEL_DEBUG
          The loglevel at which fatal, error, warning, information and debug messages are logged.
static int LEVEL_ERROR
          The loglevel at which fatal and error messages are logged.
static int LEVEL_FATAL
          The loglevel at which only fatal messages are logged.
static int LEVEL_INFO
          The loglevel at which fatal, error, warning and information messages are logged.
static int LEVEL_OFF
          The loglevel at which no messages are logged at all.
static int LEVEL_WARN
          The loglevel at which fatal, error and warning messages are logged.
 
Method Summary
 void debug(Object message)
          Logs the given message if the debug loglevel is active.
 void error(Object message)
          Logs the given message if the error loglevel is active.
 void fatal(Object message)
          Logs the given message if the fatal loglevel is active.
 int getLevel()
          Returns the current loglevel.
 void info(Object message)
          Logs the given message if the info loglevel is active.
 void init(Properties config)
          This method is called by the ConsensusFoundation constructor to initialize the LoggingManager.
 boolean isDebugEnabled()
          Checks if the debug loglevel is enabled.
 boolean isErrorEnabled()
          Checks if the error loglevel is enabled.
 boolean isFatalEnabled()
          Checks if the fatal loglevel is enabled.
 boolean isInfoEnabled()
          Checks if the info loglevel is enabled.
 boolean isWarnEnabled()
          Checks if the warning loglevel is enabled.
 void setLevel(int level)
          Changes the loglevel.
 void warn(Object message)
          Logs the given message if the warning loglevel is active.
 
Methods inherited from interface de.uka.ipd.consensus.foundation.ConsensusFoundationModule
getConsensusFoundationManager, getVersion, initCompleted, shutdown
 

Field Detail

LEVEL_ALL

public static final int LEVEL_ALL
The loglevel at which all messages are logged.

See Also:
setLevel(int), Constant Field Values

LEVEL_DEBUG

public static final int LEVEL_DEBUG
The loglevel at which fatal, error, warning, information and debug messages are logged.

See Also:
setLevel(int), Constant Field Values

LEVEL_INFO

public static final int LEVEL_INFO
The loglevel at which fatal, error, warning and information messages are logged.

See Also:
setLevel(int), Constant Field Values

LEVEL_WARN

public static final int LEVEL_WARN
The loglevel at which fatal, error and warning messages are logged.

See Also:
setLevel(int), Constant Field Values

LEVEL_ERROR

public static final int LEVEL_ERROR
The loglevel at which fatal and error messages are logged.

See Also:
setLevel(int), Constant Field Values

LEVEL_FATAL

public static final int LEVEL_FATAL
The loglevel at which only fatal messages are logged.

See Also:
setLevel(int), Constant Field Values

LEVEL_OFF

public static final int LEVEL_OFF
The loglevel at which no messages are logged at all.

See Also:
setLevel(int), Constant Field Values
Method Detail

init

public void init(Properties config)
          throws Exception
This method is called by the ConsensusFoundation constructor to initialize the LoggingManager.

Parameters:
config - all entries from ConsensusFoundation.properties
Throws:
Exception - if any error occurs (startup of the application is aborted in this case)
See Also:
ConsensusFoundation.ConsensusFoundation()

setLevel

public void setLevel(int level)
Changes the loglevel. See the loglevel constants in this interface.

Parameters:
level - the new loglevel
See Also:
getLevel()

getLevel

public int getLevel()

Returns the current loglevel. See the loglevel constants in this interface.

To check whether a certain level is active, use one of the isXXXEnabled() methods.

Returns:
the current loglevel
See Also:
setLevel(int)

isDebugEnabled

public boolean isDebugEnabled()
Checks if the debug loglevel is enabled. This is true if a higher level (all) is enabled, too.

Returns:
true if debugging messages are logged, false otherwise
See Also:
LEVEL_DEBUG

isInfoEnabled

public boolean isInfoEnabled()
Checks if the info loglevel is enabled. This is true if a higher level (debug, all) is enabled, too.

Returns:
true if info messages are logged, false otherwise
See Also:
LEVEL_INFO

isWarnEnabled

public boolean isWarnEnabled()
Checks if the warning loglevel is enabled. This is true if a higher level (info, debug, all) is enabled, too.

Returns:
true if warning messages are logged, false otherwise
See Also:
LEVEL_WARN

isErrorEnabled

public boolean isErrorEnabled()
Checks if the error loglevel is enabled. This is true if a higher level (warn, info, debug, all) is enabled, too.

Returns:
true if error messages are logged, false otherwise
See Also:
LEVEL_ERROR

isFatalEnabled

public boolean isFatalEnabled()
Checks if the fatal loglevel is enabled. This is true if a higher level (error, warn, info, debug, all) is enabled, too.

Returns:
true if fatal messages are logged, false otherwise
See Also:
LEVEL_FATAL

debug

public void debug(Object message)
Logs the given message if the debug loglevel is active.

Parameters:
message - the message to be logged
See Also:
isDebugEnabled()

info

public void info(Object message)
Logs the given message if the info loglevel is active.

Parameters:
message - the message to be logged
See Also:
isInfoEnabled()

warn

public void warn(Object message)
Logs the given message if the warning loglevel is active.

Parameters:
message - the message to be logged
See Also:
isWarnEnabled()

error

public void error(Object message)
Logs the given message if the error loglevel is active.

Parameters:
message - the message to be logged
See Also:
isErrorEnabled()

fatal

public void fatal(Object message)
Logs the given message if the fatal loglevel is active.

Parameters:
message - the message to be logged
See Also:
isFatalEnabled()