org.arakhne.logging
Class AbstractLogger

java.lang.Object
  extended by org.arakhne.logging.AbstractLogger
All Implemented Interfaces:
Logger
Direct Known Subclasses:
AbstractStandAloneLogger, SunLogger

public abstract class AbstractLogger
extends Object
implements Logger

This class provides the base for a concrete implementation of the Logger interface.

Version:
1.7 (rev:285) 2011-10-14 12:02:59
Author:
Stéphane GALLAND
See Also:
Logger
Maven Group Id:
org.arakhne.afc
Maven Artifact Id:
arakhneLogger

Constructor Summary
AbstractLogger()
           
 
Method Summary
 void addLoggerEventListener(LoggerEventListener listener)
          Add listener on logger events.
 void debug(Object source, String arg0)
          Log a message at the DEBUG level.
 void debug(Object source, String arg0, Throwable arg1)
          
 void error(Object source, String arg0)
          Log a message at the ERROR level.
 void error(Object source, String arg0, Throwable arg1)
          Log an exception (throwable) at the ERROR level with an accompanying message.
protected  void fireLoggerEvent(Object source, LogLevel level, String message)
          Notify the logger event listeners.
protected  void fireLoggerEvent(Object source, LogLevel level, String message, Throwable exception)
          Notify the logger event listeners.
 LogLevel getLogLevel()
          Replies the minimum log level.
 void info(Object source, String arg0)
          Log a message at the INFO level.
 void info(Object source, String arg0, Throwable arg1)
          Log an exception (throwable) at the INFO level with an accompanying message.
 boolean isDebugEnabled()
          
 boolean isErrorEnabled()
          
 boolean isInfoEnabled()
          
protected  boolean isLoggableFor(LogLevel requestedLevel)
          Check if logging is allowed.
 boolean isWarnEnabled()
          
 void log(Object source, LogLevel level, String msg)
          
 void removeLoggerEventListener(LoggerEventListener listener)
          Remove listener on logger events.
 void setLogLevel(LogLevel level)
          Set the minimum log level.
 void warn(Object source, String arg0)
          Log a message at the WARN level.
 void warn(Object source, String arg0, Throwable arg1)
          Log an exception (throwable) at the WARN level with an accompanying message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.arakhne.logging.Logger
getName, log
 

Constructor Detail

AbstractLogger

public AbstractLogger()
Method Detail

isLoggableFor

protected final boolean isLoggableFor(LogLevel requestedLevel)
Check if logging is allowed.

Parameters:
requestedLevel - is the level to check.
Returns:
true if logging is allowed, false otherwise

setLogLevel

public void setLogLevel(LogLevel level)
Set the minimum log level.

Specified by:
setLogLevel in interface Logger

getLogLevel

public final LogLevel getLogLevel()
Replies the minimum log level.

Specified by:
getLogLevel in interface Logger
Returns:
the minimal log level

debug

public final void debug(Object source,
                        String arg0,
                        Throwable arg1)

Specified by:
debug in interface Logger
Parameters:
source - - the object which send this log
arg0 - the message accompanying the exception
arg1 - the exception (throwable) to log

debug

public final void debug(Object source,
                        String arg0)
Log a message at the DEBUG level.

Specified by:
debug in interface Logger
Parameters:
source - - the object which send this log
arg0 - the message string to be logged

error

public final void error(Object source,
                        String arg0,
                        Throwable arg1)
Log an exception (throwable) at the ERROR level with an accompanying message.

Specified by:
error in interface Logger
Parameters:
source - - the object which send this log
arg0 - the message accompanying the exception
arg1 - the exception (throwable) to log

error

public final void error(Object source,
                        String arg0)
Log a message at the ERROR level.

Specified by:
error in interface Logger
Parameters:
source - - the object which send this log
arg0 - the message string to be logged

info

public final void info(Object source,
                       String arg0,
                       Throwable arg1)
Log an exception (throwable) at the INFO level with an accompanying message.

Specified by:
info in interface Logger
Parameters:
source - - the object which send this log
arg0 - the message accompanying the exception
arg1 - the exception (throwable) to log

info

public final void info(Object source,
                       String arg0)
Log a message at the INFO level.

Specified by:
info in interface Logger
Parameters:
source - - the object which send this log
arg0 - the message string to be logged

warn

public final void warn(Object source,
                       String arg0,
                       Throwable arg1)
Log an exception (throwable) at the WARN level with an accompanying message.

Specified by:
warn in interface Logger
Parameters:
source - - the object which send this log
arg0 - the message accompanying the exception
arg1 - the exception (throwable) to log

warn

public final void warn(Object source,
                       String arg0)
Log a message at the WARN level.

Specified by:
warn in interface Logger
Parameters:
source - - the object which send this log
arg0 - the message string to be logged

log

public void log(Object source,
                LogLevel level,
                String msg)

Specified by:
log in interface Logger
Parameters:
source - - the object which send this log
level - - the log level
msg - - the message to log

isDebugEnabled

public boolean isDebugEnabled()

Specified by:
isDebugEnabled in interface Logger
Returns:

isErrorEnabled

public boolean isErrorEnabled()

Specified by:
isErrorEnabled in interface Logger
Returns:

isInfoEnabled

public boolean isInfoEnabled()

Specified by:
isInfoEnabled in interface Logger
Returns:

isWarnEnabled

public boolean isWarnEnabled()

Specified by:
isWarnEnabled in interface Logger
Returns:

addLoggerEventListener

public final void addLoggerEventListener(LoggerEventListener listener)
Add listener on logger events.

Specified by:
addLoggerEventListener in interface Logger
Parameters:
listener -

removeLoggerEventListener

public void removeLoggerEventListener(LoggerEventListener listener)
Remove listener on logger events.

Specified by:
removeLoggerEventListener in interface Logger
Parameters:
listener -

fireLoggerEvent

protected final void fireLoggerEvent(Object source,
                                     LogLevel level,
                                     String message)
Notify the logger event listeners.

Parameters:
source - is the object which has log the message.
level - is the level of the message
message - is the text of the message.

fireLoggerEvent

protected final void fireLoggerEvent(Object source,
                                     LogLevel level,
                                     String message,
                                     Throwable exception)
Notify the logger event listeners.

Parameters:
source - is the object which has log the message.
level - is the level of the message
message - is the text of the message.
exception - is the exception associated to the message.


Copyright © 2006-2011 Arakhnê.org Consortium. All rights reserved under LGPL license terms.