org.jlog2
Class LoggerFactory

java.lang.Object
  extended by org.jlog2.LoggerFactory
Direct Known Subclasses:
CustomLoggerFactory

public abstract class LoggerFactory
extends java.lang.Object

This abstract class must be implemented to return logger instances for each specific logger type.


Field Summary
protected  java.util.Hashtable debugChannels
          The debug channels mapped to the appropriate logger ids.
protected static java.lang.String debugLevel
          The highest level to log debug errors at
protected  java.util.Hashtable logChannels
          The log channels mapped to the appropriate logger ids.
protected static java.lang.String logLevel
          The highest level to log messages at
protected static PropertiesParser propsParser
          Logging properties
 
Constructor Summary
LoggerFactory()
           
 
Method Summary
 java.util.Hashtable getAllDebugChannels()
          Get all channels to write the debug messages to, as a list.
 java.util.Hashtable getAllLogChannels()
          Get all channels to write the log messages to, as a list.
protected abstract  java.util.Vector getDebugChannels()
          Get the list of debug channels.
static java.lang.String getDebugLevel()
          Get the level to debug messages to.
static LoggerFactory getInstance()
          Get the created instance of the logger factory.
protected abstract  java.util.Vector getLogChannels()
          Get the list of log channels.
abstract  Logger getLoggerInstance(java.lang.String loggerID)
          Create a new instance of Logger.
static java.lang.String getLogLevel()
          Get the level to log messages to.
 void resetChannels()
          Reset the channels by reading the properties file again and adding any new standard ones, or updating the values of the existing ones.
static void setDebugLevel(java.lang.String theDebugLevel)
          Set the level to debug messages to.
static void setLoggerFactory(LoggerFactory thisLoggerFactory)
          Set the instance of the logger factory to be used.
static void setLogLevel(java.lang.String theLogLevel)
          Set the level to log messages to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

propsParser

protected static PropertiesParser propsParser
Logging properties


logChannels

protected java.util.Hashtable logChannels
The log channels mapped to the appropriate logger ids. Keys are the logger ids of type String and values are the log channels of type LogChannels.


debugChannels

protected java.util.Hashtable debugChannels
The debug channels mapped to the appropriate logger ids. Keys are the logger ids of type String and values are the debug channels of type LogChannels.


logLevel

protected static java.lang.String logLevel
The highest level to log messages at


debugLevel

protected static java.lang.String debugLevel
The highest level to log debug errors at

Constructor Detail

LoggerFactory

public LoggerFactory()
Method Detail

getInstance

public static LoggerFactory getInstance()
Get the created instance of the logger factory.

Returns:
the value of instance.

setLoggerFactory

public static void setLoggerFactory(LoggerFactory thisLoggerFactory)
Set the instance of the logger factory to be used.

Parameters:
thisLoggerFactory - the logger factory to use.

getLoggerInstance

public abstract Logger getLoggerInstance(java.lang.String loggerID)
Create a new instance of Logger.

Parameters:
loggerID - the id to identify one logger from another.
Returns:
the newly created logger.

getLogChannels

protected abstract java.util.Vector getLogChannels()
Get the list of log channels.

Returns:
a list of all log channels.

getDebugChannels

protected abstract java.util.Vector getDebugChannels()
Get the list of debug channels.

Returns:
a list of all debug channels.

resetChannels

public void resetChannels()
                   throws java.lang.Exception
Reset the channels by reading the properties file again and adding any new standard ones, or updating the values of the existing ones.

Throws:
java.lang.Exception - any error.

getAllLogChannels

public java.util.Hashtable getAllLogChannels()
Get all channels to write the log messages to, as a list.

Returns:
a list of all default log channels.

getAllDebugChannels

public java.util.Hashtable getAllDebugChannels()
Get all channels to write the debug messages to, as a list.

Returns:
a list of all default debug channels.

setLogLevel

public static void setLogLevel(java.lang.String theLogLevel)
Set the level to log messages to.

Parameters:
theLogLevel - the level to log messages to.

getLogLevel

public static java.lang.String getLogLevel()
Get the level to log messages to.

Returns:
the value of logLevel.

setDebugLevel

public static void setDebugLevel(java.lang.String theDebugLevel)
Set the level to debug messages to.

Parameters:
theDebugLevel - the level to debug messages to.

getDebugLevel

public static java.lang.String getDebugLevel()
Get the level to debug messages to.

Returns:
the value of debugLevel.