org.objectweb.util.monolog.wrapper.log4j
Class MonologLoggerFactory

java.lang.Object
  extended byorg.objectweb.util.monolog.wrapper.common.AbstractFactory
      extended byorg.objectweb.util.monolog.wrapper.log4j.MonologLoggerFactory
All Implemented Interfaces:
Configurable, HandlerFactory, LevelFactory, LoggerFactory, MonologFactory

public class MonologLoggerFactory
extends AbstractFactory

This class wraps the LoggerFactory, HandlerFactory, LevelFactory concepts into the log4j world. This implementation supports also the Configurable interface. Then it is possible to specify a log4j configuration file.

Author:
Sebastien Chassande-Barrioz

Field Summary
static java.lang.String LOG4J_CF_PROP
           
static java.lang.String LOG4J_CF_VALUE
           
protected  Logger rootLogger
          The root logger of the logger hierarchy
 
Fields inherited from class org.objectweb.util.monolog.wrapper.common.AbstractFactory
debug, handlers, handlerType2className, handlerTypes, intToNames, nameToLevel, resourceBundleName
 
Fields inherited from interface org.objectweb.util.monolog.api.MonologFactory
DEFAULT, LOG_CONFIGURATION_FILE, LOG_CONFIGURATION_FILE_USE_CLASSPATH, LOG_CONFIGURATION_TYPE, PROPERTY, XML
 
Constructor Summary
MonologLoggerFactory()
          It intializes the data struture, defines the default level and the root logger.
 
Method Summary
 void configure(java.util.Properties prop)
          This method permits to configure the factory with tha specific configuration file: like a log4j.properties
protected  java.lang.String[][] getDefaultHandlerType2className()
           
 Logger getLogger(java.lang.String key)
          This method permits to fetch a Logger.
 Logger getLogger(java.lang.String key, java.lang.String rbn)
          This method permits to fetch a Logger.
 Logger[] getLoggers()
          It retrieves a list of all loggers.
 java.lang.String getWrapperName()
           
 
Methods inherited from class org.objectweb.util.monolog.wrapper.common.AbstractFactory
createHandler, debug, defineLevel, defineLevel, getHandler, getHandlers, getLevel, getLevel, getLevels, getResourceBundleName, initHandlerType2className, removeHandler, removeLevel, setResourceBundleName, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG4J_CF_PROP

public static final java.lang.String LOG4J_CF_PROP
See Also:
Constant Field Values

LOG4J_CF_VALUE

public static final java.lang.String LOG4J_CF_VALUE
See Also:
Constant Field Values

rootLogger

protected Logger rootLogger
The root logger of the logger hierarchy

Constructor Detail

MonologLoggerFactory

public MonologLoggerFactory()
It intializes the data struture, defines the default level and the root logger.

Method Detail

getWrapperName

public java.lang.String getWrapperName()
Specified by:
getWrapperName in class AbstractFactory

getDefaultHandlerType2className

protected java.lang.String[][] getDefaultHandlerType2className()
Specified by:
getDefaultHandlerType2className in class AbstractFactory

configure

public void configure(java.util.Properties prop)
               throws java.lang.Exception
This method permits to configure the factory with tha specific configuration file: like a log4j.properties

Specified by:
configure in interface MonologFactory
Specified by:
configure in class AbstractFactory
Throws:
java.lang.Exception

getLogger

public Logger getLogger(java.lang.String key)
Description copied from interface: LoggerFactory
This method permits to fetch a Logger. If the Logger described by the parameters does not exist, then the LoggerFactory must return a new instance of Logger. The key parameter is a description of the expected Logger. In simple cases, the key is the initial topic of the Logger.

Specified by:
getLogger in interface LoggerFactory
Specified by:
getLogger in class AbstractFactory

getLogger

public Logger getLogger(java.lang.String key,
                        java.lang.String rbn)
Description copied from interface: LoggerFactory
This method permits to fetch a Logger. If the Logger described by the parameters does not exist, then the LoggerFactory must return a new instance of Logger. The key parameter is a description of the expected Logger. In simple cases, the key is the initial topic of the Logger. The resourceBundleName parameter allows specifying the name of a resource bundle in order to internationalise the logging.


getLoggers

public Logger[] getLoggers()
Description copied from interface: LoggerFactory
It retrieves a list of all loggers.

Specified by:
getLoggers in interface LoggerFactory
Specified by:
getLoggers in class AbstractFactory