public class LoggerImpl extends java.lang.Object implements TopicalLogger, MonologFactory
Modifier and Type | Field and Description |
---|---|
protected boolean |
additivity |
protected java.util.Hashtable |
handlers |
protected java.util.Map |
levels |
protected java.lang.String |
name |
static java.lang.String |
PRINT_WRITER |
protected java.util.Vector |
topics |
APPEND_MODE_ATTRIBUTE, BUFFER_ATTRIBUTE, CONSOLE_HANDLER_TYPE, FILE_HANDLER_TYPE, FILE_NUMBER_ATTRIBUTE, GENERIC_HANDLER_TYPE, JMX_HANDLER_TYPE, LEVEL_ATTRIBUTE, LOGGER_HANDLER_TYPE, MAX_SIZE_ATTRIBUTE, OUTPUT_ATTRIBUTE, PATTERN_ATTRIBUTE, ROLLING_FILE_HANDLER_TYPE
DEFAULT, LOG_CONFIGURATION_FILE, LOG_CONFIGURATION_FILE_USE_CLASSPATH, LOG_CONFIGURATION_TYPE, PROPERTY, XML
Constructor and Description |
---|
LoggerImpl()
This constructor permits to specify the printWriter linked to this
logger
|
LoggerImpl(java.io.PrintWriter _pw)
This constructor permits to specify the printWriter linked to this
logger
|
LoggerImpl(java.lang.String n,
java.io.PrintWriter _pw)
This constructor permits to specify the printWriter linked to this
logger
|
Modifier and Type | Method and Description |
---|---|
void |
addHandler(Handler h)
A TopicalLogger manages a list of Handler instances.
|
void |
addMonologFactoryListener(MonologFactoryListener mfl)
register a listener for the events of this MonologFactory
|
void |
addTopic(java.lang.String topic)
This method allows adding a topic to a TopicalLogger.
|
void |
configure(java.util.Properties prop)
This method permits to order to a monolog wrapper to configure the
underlying log system.
|
Handler |
createHandler(java.lang.String hn,
java.lang.String handlertype)
It retrieves a new instance of an handler which the type is specified
by the parameter.
|
Level |
defineLevel(java.lang.String name,
int value)
It defines a new Level with a name and an integer value.
|
Level |
defineLevel(java.lang.String name,
java.lang.String value)
It defines a new Level with a name and a string value.
|
static java.lang.String |
format(java.lang.String msg,
int removeTopStack)
This method permits to format messages.
|
boolean |
getAdditivity()
It retrieves the additivity flag for this logger instance.
|
java.lang.Object |
getAttribute(java.lang.String name)
It retrieves the value of an attribute value of the handler.
|
java.lang.String[] |
getAttributeNames()
It retrieves the attributes of the handler
|
int |
getCurrentIntLevel()
Gets the CurrentIntLevel attribute of the LoggerImpl object
|
Level |
getCurrentLevel()
Gets the CurrentLevel attribute of the LoggerImpl object
|
Handler[] |
getHandler()
It returns the list of the handler associated to this logger.
|
Handler |
getHandler(java.lang.String hn)
It returns the handler which the name is equals to the parameter
|
Handler[] |
getHandlers()
It retrieves all handler managed by this factory.
|
Level |
getLevel(int value)
This method is not synchronized because the configuration is rarely
|
Level |
getLevel(java.lang.String name)
It retrieves a Level instance which the name is equals to the parameter.
|
Level[] |
getLevels()
This method is not synchronized because the configuration is rarely
|
Logger |
getLogger(java.lang.String key)
This method permits to fetch a Logger.
|
Logger |
getLogger(java.lang.String key,
java.lang.String resourceBundleName)
This method permits to fetch a Logger.
|
Logger[] |
getLoggers()
It retrieves a list of all loggers.
|
java.lang.String |
getName()
It retrieves the name of the handler
|
java.io.PrintWriter |
getPrintWriter() |
java.lang.String |
getResourceBundleName()
Accessors to a resource bundle name associated to a LoggerFactory.
|
java.lang.String[] |
getTopic()
This method allows getting a topic list of this TopicalLogger.
|
java.util.Enumeration |
getTopics()
Gets the Topics attribute of the LoggerImpl object
|
java.lang.String |
getType()
It retrieves the Handler type
|
boolean |
isLoggable(int l)
Gets the Loggable attribute of the LoggerImpl object
|
boolean |
isLoggable(Level l)
Gets the Loggable attribute of the LoggerImpl object
|
boolean |
isOn()
Gets the On attribute of the LoggerImpl object
|
void |
log(int level,
java.lang.Object o)
Log method
|
void |
log(int level,
java.lang.Object o,
java.lang.Object location,
java.lang.Object method)
Log method
|
void |
log(int level,
java.lang.Object o,
java.lang.Throwable t)
Log method
|
void |
log(int level,
java.lang.Object o,
java.lang.Throwable t,
java.lang.Object location,
java.lang.Object method)
Log method
|
void |
log(Level l,
java.lang.Object o)
Log method
|
void |
log(Level l,
java.lang.Object o,
java.lang.Object location,
java.lang.Object method)
Log method
|
void |
log(Level l,
java.lang.Object o,
java.lang.Throwable t)
Log method
|
void |
log(Level l,
java.lang.Object o,
java.lang.Throwable t,
java.lang.Object location,
java.lang.Object method)
Log method
|
void |
removeAllHandlers()
A TopicalLogger manages a list of Handler instances.
|
void |
removeHandler(Handler h)
A TopicalLogger manages a list of Handler instances.
|
Handler |
removeHandler(java.lang.String handlername)
It removes the handler which the name is specified by the parameter
|
void |
removeLevel(java.lang.String name)
It removes a Level instance to this manager.
|
void |
removeMonologFactoryListener(MonologFactoryListener mfl)
forget a listener for the events of this MonologFactory
|
void |
removeTopic(java.lang.String topic)
This method allows removing a topic to a TopicalLogger.
|
void |
setAdditivity(boolean a)
It assigns the additivity flag for this logger instance.
|
java.lang.Object |
setAttribute(java.lang.String name,
java.lang.Object value)
It assigns an attributte to the handler.
|
void |
setIntLevel(int l)
Sets the IntLevel attribute of the LoggerImpl object
|
void |
setLevel(Level l)
Sets the Level attribute of the LoggerImpl object
|
void |
setName(java.lang.String n)
It assigns the name of the handler
|
void |
setResourceBundleName(java.lang.String resourceBundleName)
Accessors to a resource bundle name associated to a LoggerFactory.
|
java.lang.String |
toString()
The toString method is override to signal the logger imlementation
fowards its messages to a printwriter
|
void |
turnOff()
Turn off this logger
|
void |
turnOn()
Turn on this logger
|
public static final java.lang.String PRINT_WRITER
protected java.lang.String name
protected java.util.Vector topics
protected java.util.Hashtable handlers
protected boolean additivity
protected java.util.Map levels
public LoggerImpl()
public LoggerImpl(java.io.PrintWriter _pw)
_pw
- the printwriterpublic LoggerImpl(java.lang.String n, java.io.PrintWriter _pw)
_pw
- the printwriterpublic java.io.PrintWriter getPrintWriter()
public void addMonologFactoryListener(MonologFactoryListener mfl)
MonologFactory
addMonologFactoryListener
in interface MonologFactory
public void removeMonologFactoryListener(MonologFactoryListener mfl)
MonologFactory
removeMonologFactoryListener
in interface MonologFactory
public void configure(java.util.Properties prop) throws java.lang.Exception
MonologFactory
configure
in interface MonologFactory
prop
- contains properties which describes the way to configure.
In particular three properties could be used:
java.lang.Exception
public Handler createHandler(java.lang.String hn, java.lang.String handlertype)
HandlerFactory
createHandler
in interface HandlerFactory
handlertype
- is the type of the parameter. The possible value are
defined in this interface by the XXX_HANDLER_TYPE constants.public Handler removeHandler(java.lang.String handlername)
HandlerFactory
removeHandler
in interface HandlerFactory
handlername
- is the name of the handlerpublic Handler[] getHandlers()
HandlerFactory
getHandlers
in interface HandlerFactory
public Level defineLevel(java.lang.String name, int value)
LevelFactory
defineLevel
in interface LevelFactory
name
- is the name of the new levelvalue
- is the integer value of the new levelpublic Level defineLevel(java.lang.String name, java.lang.String value)
LevelFactory
defineLevel
in interface LevelFactory
name
- is the name of the new levelvalue
- is the string value of the new levelpublic Level getLevel(java.lang.String name)
LevelFactory
getLevel
in interface LevelFactory
name
- is the name of request Levelpublic Level getLevel(int value)
getLevel
in interface LevelFactory
value
- is the integer value of request Levelpublic Level[] getLevels()
getLevels
in interface LevelFactory
public void removeLevel(java.lang.String name)
LevelFactory
removeLevel
in interface LevelFactory
public Logger getLogger(java.lang.String key)
LoggerFactory
getLogger
in interface LoggerFactory
public Logger getLogger(java.lang.String key, java.lang.String resourceBundleName)
LoggerFactory
getLogger
in interface LoggerFactory
public java.lang.String getResourceBundleName()
LoggerFactory
getResourceBundleName
in interface LoggerFactory
public void setResourceBundleName(java.lang.String resourceBundleName)
LoggerFactory
setResourceBundleName
in interface LoggerFactory
public Logger[] getLoggers()
LoggerFactory
getLoggers
in interface LoggerFactory
public void setIntLevel(int l)
setIntLevel
in interface Logger
l
- The new IntLevel valuepublic void setLevel(Level l)
public int getCurrentIntLevel()
getCurrentIntLevel
in interface Logger
public Level getCurrentLevel()
getCurrentLevel
in interface Logger
public boolean isLoggable(int l)
isLoggable
in interface Logger
l
- Description of Parameterpublic boolean isLoggable(Level l)
isLoggable
in interface Logger
l
- Description of Parameterpublic boolean isOn()
public java.util.Enumeration getTopics()
getTopics
in interface TopicalLogger
public void log(int level, java.lang.Object o, java.lang.Throwable t)
public void log(Level l, java.lang.Object o, java.lang.Throwable t)
public void log(int level, java.lang.Object o, java.lang.Object location, java.lang.Object method)
public void log(Level l, java.lang.Object o, java.lang.Object location, java.lang.Object method)
public void log(int level, java.lang.Object o, java.lang.Throwable t, java.lang.Object location, java.lang.Object method)
public void log(Level l, java.lang.Object o, java.lang.Throwable t, java.lang.Object location, java.lang.Object method)
public java.lang.String toString()
toString
in class java.lang.Object
public void addHandler(Handler h) throws java.lang.Exception
TopicalLogger
addHandler
in interface TopicalLogger
java.lang.Exception
public void addTopic(java.lang.String topic) throws java.lang.Exception
TopicalLogger
addTopic
in interface TopicalLogger
java.lang.Exception
public void removeHandler(Handler h) throws java.lang.Exception
TopicalLogger
removeHandler
in interface TopicalLogger
java.lang.Exception
public void removeAllHandlers() throws java.lang.Exception
TopicalLogger
removeAllHandlers
in interface TopicalLogger
java.lang.Exception
public void removeTopic(java.lang.String topic) throws java.lang.Exception
TopicalLogger
removeTopic
in interface TopicalLogger
java.lang.Exception
public void setAdditivity(boolean a)
TopicalLogger
setAdditivity
in interface TopicalLogger
public boolean getAdditivity()
TopicalLogger
getAdditivity
in interface TopicalLogger
public Handler[] getHandler()
TopicalLogger
getHandler
in interface TopicalLogger
public Handler getHandler(java.lang.String hn)
TopicalLogger
getHandler
in interface HandlerFactory
getHandler
in interface TopicalLogger
hn
- is the name of the handlerpublic java.lang.String[] getTopic()
TopicalLogger
getTopic
in interface TopicalLogger
public java.lang.String getName()
Handler
public void setName(java.lang.String n)
Handler
public java.lang.String getType()
Handler
public java.lang.String[] getAttributeNames()
Handler
getAttributeNames
in interface Handler
public java.lang.Object getAttribute(java.lang.String name)
Handler
getAttribute
in interface Handler
name
- is an attribute namepublic java.lang.Object setAttribute(java.lang.String name, java.lang.Object value)
Handler
setAttribute
in interface Handler
name
- is the attribute namevalue
- is the attribute valuepublic static java.lang.String format(java.lang.String msg, int removeTopStack)