de.uniba.wiai.lspi.util.logging
Class Logger

java.lang.Object
  extended by de.uniba.wiai.lspi.util.logging.Logger
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
DummyLogger, Log4jLogger, SystemOutPrintlnLogger

public abstract class Logger
extends Object
implements Serializable

This class is the abstract class to be implemented by a logger that should be used within the framework.
A reference to a logger can be obtained by getLogger(java.lang.String) or getLogger(java.lang.Class).
You can use a custom logger by extending this class and setting the system property de.uniba.wiai.lspi.util.logging.logger.class to the FQN of your logger class.
getLogger(java.lang.String) or getLogger(java.lang.Class) then try to instantiate your logger. If that fails one of the standard loggers is created. The standard logger is Log4jLogger. If log4j is not availalbe from the classpath DummyLogger is the standard logger. If you set the system property de.uniba.wiai.lspi.util.logging.off to true DummyLogger is the standard logger.
When implementing a custom logger you have to consider that the logger may be transferred over the network when classes are passed as parameters to remote methods. The custom logger must have a public constructor with String as parameter.

See Also:
Serialized Form

Nested Class Summary
static class Logger.LogLevel
           
 
Field Summary
static String LOGGER_CLASS_NAME_PROPERTY_NAME
          Name of property that specifies the name of the logger class to be used.
static String LOGGING_OFF_PROPERTY_NAME
          Name of property that defines if logging is off.
protected  String name
          The name of the class, for which this is the logger.
 
Constructor Summary
protected Logger(String name)
          Creates a new instance of Logger
 
Method Summary
abstract  void debug(Object msg)
           
abstract  void debug(Object msg, Throwable t)
           
abstract  void error(Object msg)
           
abstract  void error(Object msg, Throwable t)
           
abstract  void fatal(Object msg)
           
abstract  void fatal(Object msg, Throwable t)
           
static Logger getLogger(Class _class)
           
static Logger getLogger(String name)
           
abstract  void info(Object msg)
           
abstract  void info(Object msg, Throwable t)
           
abstract  boolean isEnabledFor(Logger.LogLevel l)
           
abstract  void warn(Object msg)
           
abstract  void warn(Object msg, Throwable t)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER_CLASS_NAME_PROPERTY_NAME

public static final String LOGGER_CLASS_NAME_PROPERTY_NAME
Name of property that specifies the name of the logger class to be used.

See Also:
Constant Field Values

LOGGING_OFF_PROPERTY_NAME

public static final String LOGGING_OFF_PROPERTY_NAME
Name of property that defines if logging is off.

See Also:
Constant Field Values

name

protected String name
The name of the class, for which this is the logger.

Constructor Detail

Logger

protected Logger(String name)
Creates a new instance of Logger

Parameters:
name -
Method Detail

getLogger

public static Logger getLogger(Class _class)
Parameters:
_class -
Returns:
The logger for the given class.

getLogger

public static Logger getLogger(String name)
Parameters:
name -
Returns:
The logger with the given name.

isEnabledFor

public abstract boolean isEnabledFor(Logger.LogLevel l)

debug

public abstract void debug(Object msg)
Parameters:
msg -

debug

public abstract void debug(Object msg,
                           Throwable t)
Parameters:
msg -
t -

info

public abstract void info(Object msg)
Parameters:
msg -

info

public abstract void info(Object msg,
                          Throwable t)
Parameters:
msg -
t -

warn

public abstract void warn(Object msg)
Parameters:
msg -

warn

public abstract void warn(Object msg,
                          Throwable t)
Parameters:
msg -
t -

error

public abstract void error(Object msg)
Parameters:
msg -

error

public abstract void error(Object msg,
                           Throwable t)
Parameters:
msg -
t -

fatal

public abstract void fatal(Object msg)
Parameters:
msg -

fatal

public abstract void fatal(Object msg,
                           Throwable t)
Parameters:
msg -
t -


Copyright © 2004-2008 Karsten Loesing, Sven Kaffille - Distributed and Mobile Systems Group, Lehrstuhl für Praktische Informatik, Universität Bamberg. All Rights Reserved.