|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsimtools.util.LogConfigurator
public class LogConfigurator
Field Summary | |
---|---|
protected java.util.ArrayList |
levels
The various log levels read from the properties |
protected java.util.logging.Level |
lowestLevel
The computed lowes level used to configure the handler |
protected java.util.logging.Handler |
outHandler
The resulting configured handler It can be either the SocketHandler if a port number defintion is found or the the FileHandler if a pattern defintion is found or the ConsoleHandler |
protected java.util.ArrayList |
prefixes
The various logger prefix read from the properties The level applied to each logger is contained at the same index in the levels list |
protected java.lang.String |
propertyPrefix
The prefix used to compute property names |
Constructor Summary | |
---|---|
LogConfigurator(java.util.Properties p,
java.lang.String prefix)
Read the logging configuration |
Method Summary | |
---|---|
void |
apply()
Apply the logging configuration to the current loggers Can be called several times in case new classes are loaded |
protected void |
configure()
Get logging configuration from properties and create the lgging handler accondingly |
protected void |
configureLevels()
Configure logging levels according to properties |
boolean |
getBoolean(java.lang.String key,
boolean defaultValue)
Get a boolean value from properties |
protected java.lang.String |
getDefaultFileHandlerPattern()
|
protected int |
getInt(java.lang.String key,
int defaultValue)
Get a int value from properties |
static java.util.logging.Logger |
getLogger(java.lang.String name)
Replace Loggger.getLogger call with this method in order to apply configuration to the new created loggers |
protected java.lang.String |
getPropertyName(java.lang.String key)
Compute the property name according to the key parameter |
protected java.lang.String |
getString(java.lang.String key,
java.lang.String defaultValue)
Get a String value from properties |
static void |
setDefaultLowestLevel(java.util.logging.Level defaultLowestLevel)
Method setDefaultLowestLevel Summary: Set the default lowest level of logs. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String propertyPrefix
protected java.util.logging.Handler outHandler
protected java.util.ArrayList levels
protected java.util.ArrayList prefixes
protected java.util.logging.Level lowestLevel
Constructor Detail |
---|
public LogConfigurator(java.util.Properties p, java.lang.String prefix)
p
- prefix
- Method Detail |
---|
public static java.util.logging.Logger getLogger(java.lang.String name)
name
- the logger name
public void apply()
protected void configure()
protected void configureLevels()
protected java.lang.String getDefaultFileHandlerPattern()
protected java.lang.String getPropertyName(java.lang.String key)
key
- to compute the property name
protected java.lang.String getString(java.lang.String key, java.lang.String defaultValue)
key
- to compute the property namedefaultValue
- the returned value if no property to define it
protected int getInt(java.lang.String key, int defaultValue)
key
- to compute the property namedefaultValue
- the returned value if no property to define it
public boolean getBoolean(java.lang.String key, boolean defaultValue)
key
- to compute the property namedefaultValue
- the returned value if no property to define it
public static void setDefaultLowestLevel(java.util.logging.Level defaultLowestLevel)
defaultLowestLevel
- the defaultLowestLevel to set. Level.SEVERE/WARNING etc..
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |