cern.cmw.rda
Class MessageLogger

java.lang.Object
  extended by cern.cmw.rda.MessageLogger

public class MessageLogger
extends Object

Provides a mechanism for logging error and trace messages.

This class defines a general interface for the message logging and provides its default implementation that writes errors to System.err and traces to System.out. Derived classes can override this default behaviour and use various system specific logging facilities.

The actual class of the logger singleton is determined by the cmw.rda.loggerClassName property; if it is not defined then the default implementation is used. If the property has an invalid value (does not identify a loadable subclass of MessageLogger) then CmwInternalError will be thrown by the getLogger method.

See Also:
CmwInternalError

Field Summary
static boolean DEBUG
           
 
Constructor Summary
protected MessageLogger()
          Constructs a default MessageLogger.
 
Method Summary
 void error(String message)
          Records the specified error message.
static MessageLogger getLogger()
          Returns the message logger singleton.
static int getTraceLevel()
          Returns the trace level.
static void setTraceLevel(int level)
          Sets the trace level to the specified value.
 void trace(int level, String message)
          Records the specified trace message if the current trace level is equal to or greater then the message level.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static boolean DEBUG
Constructor Detail

MessageLogger

protected MessageLogger()
Constructs a default MessageLogger.

Method Detail

getLogger

public static MessageLogger getLogger()
Returns the message logger singleton.


getTraceLevel

public static int getTraceLevel()
Returns the trace level.


setTraceLevel

public static void setTraceLevel(int level)
Sets the trace level to the specified value.


error

public void error(String message)
Records the specified error message.


trace

public void trace(int level,
                  String message)
Records the specified trace message if the current trace level is equal to or greater then the message level.



Copyright © 2007 CERN. All Rights Reserved.