org.talika.tarsis.log
Class LoggerHandler

java.lang.Object
  extended by org.talika.tarsis.service.AbstractService
      extended by org.talika.tarsis.log.LoggerService
          extended by org.talika.tarsis.log.LoggerHandler
All Implemented Interfaces:
Logger, Service

public final class LoggerHandler
extends LoggerService

Special implementation of Logger interface that serves as a multiplexer that writes log messages to a list of Logger instances.

Version:
$Revision: 124 $
Author:
Jose M. Palomar

Field Summary
 
Fields inherited from interface org.talika.tarsis.log.Logger
DEBUG, ERROR, INFO, PANIC, WARNING
 
Constructor Summary
LoggerHandler()
          Creates a new LoggerHandler.
 
Method Summary
 void addLogger(LoggerService logger)
          Adds a Logger instance to Logger list.
 void addLoggers(java.util.Collection loggers)
          Adds a Collection of Logger instances to Logger list.
 void destroy()
          Called by the framework to indicate that is being placed out of service.
 int getLogLevel()
          Returns log level parameter.
 java.lang.String getName()
          Returns name of service.
 void init(Context context)
          Called by the framework to indicate that is being placed into service.
 void log(int level, java.lang.String msg)
          Log a message using given level.
 void log(int level, java.lang.String msg, java.lang.Throwable t)
          Log an error message using given level.
 void setLogLevel(int logLevel)
          Sets log level parameter.
protected  void writeLog(int level, java.lang.String msg)
          Writes a message to log.
protected  void writeLog(int level, java.lang.String msg, java.lang.Throwable t)
          Writes an error message to log.
 
Methods inherited from class org.talika.tarsis.log.LoggerService
formatLog, isDebugEnabled, isErrorEnabled, isInfoEnabled, isPanicEnabled, isWarningEnabled, logDebug, logError, logInfo, logPanic, logPanic, logWarning
 
Methods inherited from class org.talika.tarsis.service.AbstractService
getContext, getLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoggerHandler

public LoggerHandler()
Creates a new LoggerHandler.

Method Detail

init

public void init(Context context)
          throws ServiceException
Called by the framework to indicate that is being placed into service.

Initializes the list of Logger instances.

Specified by:
init in interface Service
Overrides:
init in class AbstractService
Parameters:
context - Context context that initialized service.
Throws:
ServiceException - if an exception has occurred that interferes with the services's normal operation
See Also:
Service.init(Context)

destroy

public void destroy()
Called by the framework to indicate that is being placed out of service.

Destroys the list of Logger instances.

Specified by:
destroy in interface Service
Overrides:
destroy in class AbstractService
See Also:
Service.destroy()

getName

public java.lang.String getName()
Returns name of service.

Specified by:
getName in interface Service
Specified by:
getName in class AbstractService
Returns:
String name of service.
See Also:
Service.getName()

addLogger

public void addLogger(LoggerService logger)
Adds a Logger instance to Logger list.

Parameters:
logger - LoggerService a Logger instance.

addLoggers

public void addLoggers(java.util.Collection loggers)
Adds a Collection of Logger instances to Logger list.

Parameters:
loggers - Collection a Collection of Logger instances.

getLogLevel

public int getLogLevel()
Returns log level parameter.

Specified by:
getLogLevel in interface Logger
Overrides:
getLogLevel in class LoggerService
Returns:
int log level parameter.
See Also:
Logger.getLogLevel()

setLogLevel

public void setLogLevel(int logLevel)
Sets log level parameter.

Overrides:
setLogLevel in class LoggerService
Parameters:
logLevel - int log level parameter.

log

public void log(int level,
                java.lang.String msg)
Log a message using given level.

Specified by:
log in interface Logger
Overrides:
log in class LoggerService
Parameters:
level - int log level.
msg - String message.
See Also:
Logger.log(int, String)

log

public void log(int level,
                java.lang.String msg,
                java.lang.Throwable t)
Log an error message using given level.

Specified by:
log in interface Logger
Overrides:
log in class LoggerService
Parameters:
level - int log level.
msg - String message.
t - Throwable a Throwable object.
See Also:
Logger.log(int, String, Throwable)

writeLog

protected void writeLog(int level,
                        java.lang.String msg)
Writes a message to log.

Specified by:
writeLog in class LoggerService
Parameters:
level - int log level.
msg - String message.

writeLog

protected void writeLog(int level,
                        java.lang.String msg,
                        java.lang.Throwable t)
Writes an error message to log.

Specified by:
writeLog in class LoggerService
Parameters:
level - int log level.
msg - String message.
t - Throwable a Throwable object.


Copyright © 2002-2012 Talika Open Source Group. All Rights Reserved.