org.montsuqi.util
Class Logger

java.lang.Object
  extended by org.montsuqi.util.Logger
Direct Known Subclasses:
J2SELogger, Log4JLogger, NullLogger, StdErrLogger

public abstract class Logger
extends java.lang.Object

An abstract logger class.

This class abstracts differences among various logging systems.

Actual class of loggers are determined by the system property "monsia.logger.factory".


Field Summary
static int DEBUG
           
static int FATAL
           
static int INFO
           
protected  int level
           
static int TRACE
           
static int WARNING
           
 
Constructor Summary
protected Logger()
           
 
Method Summary
abstract  void debug(java.lang.String message)
          Logs a message in debug level.
 void debug(java.lang.String format, java.lang.Object arg)
          Logs a formatted mesasge with given argument in debug level.
 void debug(java.lang.String format, java.lang.Object[] args)
          Logs a formatted mesasge with given arguments in debug level.
 void debug(java.lang.Throwable e)
          Logs an exception in debug level.
 void enter()
          Used to log on entering into a method with no argument.
 void enter(java.lang.Object arg1)
          Used to log on entering into a method with one argument.
 void enter(java.lang.Object[] args)
          Used to log on entering into a method with any number of arguments.
 void enter(java.lang.Object arg1, java.lang.Object arg2)
          Used to log on entering into a method with two arguments.
 void enter(java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3)
          Used to log on entering into a method with three arguments.
abstract  void fatal(java.lang.String message)
          Logs a message in fatal level.
 void fatal(java.lang.String format, java.lang.Object arg)
          Logs a formatted mesasge with given argument in fatal level.
 void fatal(java.lang.String format, java.lang.Object[] args)
          Logs a formatted mesasge with given arguments in fatal level.
 void fatal(java.lang.Throwable e)
          Logs an exception in fatal level.
protected  java.lang.String formatMessage(java.lang.String format, java.lang.Object arg)
           
protected  java.lang.String formatMessage(java.lang.String format, java.lang.Object[] args)
           
static Logger getLogger(java.lang.Class clazz)
          Creates a logger for the name of given class.
static Logger getLogger(java.lang.String name)
          Creates a logger for the given name.
abstract  void info(java.lang.String message)
          Logs a message in info level.
 void info(java.lang.String format, java.lang.Object arg)
          Logs a formatted mesasge with given argument in info level.
 void info(java.lang.String format, java.lang.Object[] args)
          Logs a formatted mesasge with given arguments in info level.
 void info(java.lang.Throwable e)
          Logs an exception in info level.
 void leave()
          Used to log on leaving a method.
abstract  void trace(java.lang.String message)
          Logs a message in trace level.
 void trace(java.lang.String format, java.lang.Object arg)
          Logs a formatted mesasge with given argument in trace level.
 void trace(java.lang.String format, java.lang.Object[] args)
          Logs a formatted mesasge with given arguments in trace level.
 void trace(java.lang.Throwable e)
          Logs an exception in trace level.
abstract  void warn(java.lang.String message)
          Logs a message in warn level.
 void warn(java.lang.String format, java.lang.Object arg)
          Logs a formatted mesasge with given argument in warn level.
 void warn(java.lang.String format, java.lang.Object[] args)
          Logs a formatted mesasge with given arguments in warn level.
 void warn(java.lang.Throwable e)
          Logs an exception in warn level.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FATAL

public static final int FATAL
See Also:
Constant Field Values

WARNING

public static final int WARNING
See Also:
Constant Field Values

INFO

public static final int INFO
See Also:
Constant Field Values

DEBUG

public static final int DEBUG
See Also:
Constant Field Values

TRACE

public static final int TRACE
See Also:
Constant Field Values

level

protected int level
Constructor Detail

Logger

protected Logger()
Method Detail

getLogger

public static Logger getLogger(java.lang.Class clazz)

Creates a logger for the name of given class.

Parameters:
clazz -

getLogger

public static Logger getLogger(java.lang.String name)

Creates a logger for the given name.

Actual class for the logger is determined by the system property "monsia.logger.factory". Possible values are:

If "monsia.logger.factory" is not set, org.montsuqi.util.StdErrLogger is used.

Parameters:
name -

enter

public void enter()

Used to log on entering into a method with no argument.


enter

public void enter(java.lang.Object arg1)

Used to log on entering into a method with one argument.

Parameters:
arg1 - argument to the method in concern.

enter

public void enter(java.lang.Object arg1,
                  java.lang.Object arg2)

Used to log on entering into a method with two arguments.

Parameters:
arg1 - first argument to the method in concern.
arg2 - second argument to the method in concern.

enter

public void enter(java.lang.Object arg1,
                  java.lang.Object arg2,
                  java.lang.Object arg3)

Used to log on entering into a method with three arguments.

Parameters:
arg1 - first argument to the method in concern.
arg2 - second argument to the method in concern.
arg3 - third argument to the method in concern.

enter

public void enter(java.lang.Object[] args)

Used to log on entering into a method with any number of arguments.

Parameters:
args - arguments to the method in concern.

leave

public void leave()

Used to log on leaving a method.


trace

public abstract void trace(java.lang.String message)

Logs a message in trace level.

Parameters:
message - the message to log.

debug

public abstract void debug(java.lang.String message)

Logs a message in debug level.

Parameters:
message - the message to log.

info

public abstract void info(java.lang.String message)

Logs a message in info level.

Parameters:
message - the message to log.

warn

public abstract void warn(java.lang.String message)

Logs a message in warn level.

Parameters:
message - the message to log.

fatal

public abstract void fatal(java.lang.String message)

Logs a message in fatal level.

Parameters:
message - the message to log.

formatMessage

protected final java.lang.String formatMessage(java.lang.String format,
                                               java.lang.Object[] args)

formatMessage

protected final java.lang.String formatMessage(java.lang.String format,
                                               java.lang.Object arg)

trace

public void trace(java.lang.String format,
                  java.lang.Object[] args)

Logs a formatted mesasge with given arguments in trace level.

Parameters:
format - the message format.
args - the objects to format.

debug

public void debug(java.lang.String format,
                  java.lang.Object[] args)

Logs a formatted mesasge with given arguments in debug level.

Parameters:
format - the message format.
args - the objects to format.

info

public void info(java.lang.String format,
                 java.lang.Object[] args)

Logs a formatted mesasge with given arguments in info level.

Parameters:
format - the message format.
args - the objects to format.

warn

public void warn(java.lang.String format,
                 java.lang.Object[] args)

Logs a formatted mesasge with given arguments in warn level.

Parameters:
format - the message format.
args - the objects to format.

fatal

public void fatal(java.lang.String format,
                  java.lang.Object[] args)

Logs a formatted mesasge with given arguments in fatal level.

Parameters:
format - the message format.
args - the objects to format.

trace

public void trace(java.lang.String format,
                  java.lang.Object arg)

Logs a formatted mesasge with given argument in trace level.

Parameters:
format - the message format.
arg - the object to format.

debug

public void debug(java.lang.String format,
                  java.lang.Object arg)

Logs a formatted mesasge with given argument in debug level.

Parameters:
format - the message format.
arg - the object to format.

info

public void info(java.lang.String format,
                 java.lang.Object arg)

Logs a formatted mesasge with given argument in info level.

Parameters:
format - the message format.
arg - the object to format.

warn

public void warn(java.lang.String format,
                 java.lang.Object arg)

Logs a formatted mesasge with given argument in warn level.

Parameters:
format - the message format.
arg - the object to format.

fatal

public void fatal(java.lang.String format,
                  java.lang.Object arg)

Logs a formatted mesasge with given argument in fatal level.

Parameters:
format - the message format.
arg - the object to format.

trace

public void trace(java.lang.Throwable e)

Logs an exception in trace level.

Parameters:
e - the exception to log.

debug

public void debug(java.lang.Throwable e)

Logs an exception in debug level.

Parameters:
e - the exception to log.

info

public void info(java.lang.Throwable e)

Logs an exception in info level.

Parameters:
e - the exception to log.

warn

public void warn(java.lang.Throwable e)

Logs an exception in warn level.

Parameters:
e - the exception to log.

fatal

public void fatal(java.lang.Throwable e)

Logs an exception in fatal level.

Parameters:
e - theexception to log.