org.objectweb.util.monolog.file.monolog

Class PropertiesConfAccess

Implemented Interfaces:
Serializable

public class PropertiesConfAccess
extends java.lang.Object
implements Serializable

This class permits to load and store a monolog configuration. The chooseen format is java.util.Properties. It also easy to write or load a Properties from a file. The encoding format is the following:
handler..=

level.=

logger..level=
logger..additivity=
logger..handler.=
logger..topic.=

Author:
Sebastien Chassande-Barrioz

Field Summary

static String
ADDITIVITY_FIELD
static String
CLEAN_HANDLERS_FIELD
static char
DOT
static String
HANDLER_FIELD
static String
HANDLER_TYPE_ATTRIBUTE
static String
HANDLER_TYPE_ATTRIBUTE_CONSOLE_VALUE
static String
HANDLER_TYPE_ATTRIBUTE_FILE_VALUE
static String
HANDLER_TYPE_ATTRIBUTE_NTEVENT_VALUE
static String
HANDLER_TYPE_ATTRIBUTE_ROLLING_FILE_VALUE
static String
LEVEL_FIELD
static String
LOGGER_FIELD
static String
TOPIC_FIELD
static String
USE_PARENT_FIELD
protected Vector
loggerCleaned

Method Summary

protected void
cleanOldHandler(TopicalLogger l)
Clear all the handlers associated to a logger which are not defined into this file
void
debug(String m)
protected String[]
getDependsLevel(String expr)
It retrieves the list of the referenced levels in the String parameter.
protected boolean
isDefaultLevel(Level l)
It checks if the level parameter is a default monolog level.
static void
load(Properties prop, LoggerFactory lof, HandlerFactory hf, LevelFactory lef)
static void
load(Properties prop, MonologFactory mf)
protected Handler
parseHandlerProp(Properties prop, String key, HandlerFactory hf)
It parses a property entry to build or configure a Handler instance.
protected Level
parseLevelProp(Properties prop, String key, LevelFactory lef)
It parses a property entry to build or configure a Level instance.
protected Level
parseLevelProp(Properties prop, String key, LevelFactory lef, Vector currentLevelParse)
It parses a property entry to build or configure a Level instance.
protected Logger
parseLoggerProp(Properties prop, String key, LoggerFactory lof, HandlerFactory hf, LevelFactory lef)
It parses a property entry to build or configure a Logger instance.
protected Logger
parseLoggerProp(Properties prop, String key, MonologFactory mf)
It parses a property entry to build or configure a Logger instance.
void
read(Properties prop, LoggerFactory lof, HandlerFactory hf, LevelFactory lef)
void
read(Properties prop, MonologFactory mf)
static void
store(Properties prop, LoggerFactory lof, HandlerFactory hf, LevelFactory lef)
static void
store(Properties prop, MonologFactory mf)
void
write(Properties prop, LoggerFactory lof, HandlerFactory hf, LevelFactory lef)

Field Details

ADDITIVITY_FIELD

public static final String ADDITIVITY_FIELD


CLEAN_HANDLERS_FIELD

public static final String CLEAN_HANDLERS_FIELD


DOT

public static final char DOT


HANDLER_FIELD

public static final String HANDLER_FIELD


HANDLER_TYPE_ATTRIBUTE

public static final String HANDLER_TYPE_ATTRIBUTE


HANDLER_TYPE_ATTRIBUTE_CONSOLE_VALUE

public static final String HANDLER_TYPE_ATTRIBUTE_CONSOLE_VALUE


HANDLER_TYPE_ATTRIBUTE_FILE_VALUE

public static final String HANDLER_TYPE_ATTRIBUTE_FILE_VALUE


HANDLER_TYPE_ATTRIBUTE_NTEVENT_VALUE

public static final String HANDLER_TYPE_ATTRIBUTE_NTEVENT_VALUE


HANDLER_TYPE_ATTRIBUTE_ROLLING_FILE_VALUE

public static final String HANDLER_TYPE_ATTRIBUTE_ROLLING_FILE_VALUE


LEVEL_FIELD

public static final String LEVEL_FIELD


LOGGER_FIELD

public static final String LOGGER_FIELD


TOPIC_FIELD

public static final String TOPIC_FIELD


USE_PARENT_FIELD

public static final String USE_PARENT_FIELD


loggerCleaned

protected Vector loggerCleaned

Method Details

cleanOldHandler

protected void cleanOldHandler(TopicalLogger l)
            throws Exception
Clear all the handlers associated to a logger which are not defined into this file


debug

public void debug(String m)


getDependsLevel

protected String[] getDependsLevel(String expr)
It retrieves the list of the referenced levels in the String parameter.

Parameters:
expr - is a string which can contain level identifier. The string is an arithmetic expression which contains number, operator and levels identifier.

Returns:
the list of the referenced levels.


isDefaultLevel

protected boolean isDefaultLevel(Level l)
It checks if the level parameter is a default monolog level. The default monolog levels are the following:
  • FATAL
  • ERROR
  • WARN
  • INFO
  • DEBUG


load

public static void load(Properties prop,
                        LoggerFactory lof,
                        HandlerFactory hf,
                        LevelFactory lef)
            throws Exception


load

public static void load(Properties prop,
                        MonologFactory mf)
            throws Exception


parseHandlerProp

protected Handler parseHandlerProp(Properties prop,
                                   String key,
                                   HandlerFactory hf)
            throws Exception
It parses a property entry to build or configure a Handler instance.

Parameters:
prop - is the property where the entry is reachable.
key - is the entry key
hf - is the handler factory to use for building a new instance or fetching existent handlers.

Returns:
the handler instance which has been built or configured


parseLevelProp

protected Level parseLevelProp(Properties prop,
                               String key,
                               LevelFactory lef)
            throws Exception
It parses a property entry to build or configure a Level instance.

Parameters:
prop - is the property where the entry is reachable.
key - is the entry key
lef - is the level factory to use for building a new instance or fetching existent levels.

Returns:
the level instance which has been built or configured


parseLevelProp

protected Level parseLevelProp(Properties prop,
                               String key,
                               LevelFactory lef,
                               Vector currentLevelParse)
            throws Exception
It parses a property entry to build or configure a Level instance.

Parameters:
prop - is the property where the entry is reachable.
key - is the entry key
lef - is the level factory to use for building a new instance or fetching existent levels.
currentLevelParse - the list of current level name which are searched.


parseLoggerProp

protected Logger parseLoggerProp(Properties prop,
                                 String key,
                                 LoggerFactory lof,
                                 HandlerFactory hf,
                                 LevelFactory lef)
            throws Exception
It parses a property entry to build or configure a Logger instance.

Parameters:
prop - is the property where the entry is reachable.
key - is the entry key
lof - is the logger factory to use for building a new instance or fetching existent loggers.
hf - is the handler factory to use for building a new instance or fetching existent handlers.
lef - is the level factory to use for building a new instance or fetching existent levels.

Returns:
the level instance which has been built or configured


parseLoggerProp

protected Logger parseLoggerProp(Properties prop,
                                 String key,
                                 MonologFactory mf)
            throws Exception
It parses a property entry to build or configure a Logger instance.

Parameters:
prop - is the property where the entry is reachable.
key - is the entry key
mf - is the monolog factory to use for building a new instance or fetching existent loggers, handlers or levels.

Returns:
the level instance which has been built or configured


read

public void read(Properties prop,
                 LoggerFactory lof,
                 HandlerFactory hf,
                 LevelFactory lef)
            throws Exception


read

public void read(Properties prop,
                 MonologFactory mf)
            throws Exception


store

public static void store(Properties prop,
                         LoggerFactory lof,
                         HandlerFactory hf,
                         LevelFactory lef)
            throws Exception


store

public static void store(Properties prop,
                         MonologFactory mf)
            throws Exception


write

public void write(Properties prop,
                  LoggerFactory lof,
                  HandlerFactory hf,
                  LevelFactory lef)
            throws Exception