Package org.jpos.util
Class Logger
- java.lang.Object
-
- org.jpos.util.Logger
-
- All Implemented Interfaces:
Configurable
,LogProducer
public class Logger extends java.lang.Object implements LogProducer, Configurable
Peer class Logger forwards LogEvents generated by LogSources to LogListeners.
This little tutorial give you additional information on how to extend the jPOS's Logger subsystem.- See Also:
LogEvent
,LogSource
,LogListener
,Loggeable
,SimpleLogListener
,RotateLogListener
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
NRPREFIX
-
Constructor Summary
Constructors Constructor Description Logger()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addListener(LogListener l)
void
destroy()
destroy loggerConfiguration
getConfiguration()
static Logger
getLogger(java.lang.String name)
java.lang.String
getName()
boolean
hasListeners()
Used by heavy used methods to avoid LogEvent creationstatic void
log(LogEvent evt)
void
removeAllListeners()
void
removeListener(LogListener l)
void
setConfiguration(Configuration cfg)
void
setName(java.lang.String name)
associates this Logger with a name using NameRegistrar
-
-
-
Field Detail
-
NRPREFIX
public static final java.lang.String NRPREFIX
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Logger
public Logger()
-
-
Method Detail
-
getConfiguration
public Configuration getConfiguration()
-
setConfiguration
public void setConfiguration(Configuration cfg) throws ConfigurationException
- Specified by:
setConfiguration
in interfaceConfigurable
- Parameters:
cfg
- Configuration object- Throws:
ConfigurationException
-
addListener
public void addListener(LogListener l)
- Specified by:
addListener
in interfaceLogProducer
-
removeListener
public void removeListener(LogListener l)
- Specified by:
removeListener
in interfaceLogProducer
-
removeAllListeners
public void removeAllListeners()
- Specified by:
removeAllListeners
in interfaceLogProducer
-
setName
public void setName(java.lang.String name)
associates this Logger with a name using NameRegistrar- Parameters:
name
- name to register- See Also:
NameRegistrar
-
destroy
public void destroy()
destroy logger
-
getLogger
public static Logger getLogger(java.lang.String name)
- Returns:
- logger instance with given name. Creates one if necessary
- See Also:
NameRegistrar
-
getName
public java.lang.String getName()
- Returns:
- this logger's name ("" if no name was set)
-
hasListeners
public boolean hasListeners()
Used by heavy used methods to avoid LogEvent creation- Returns:
- true if Logger has associated LogListsners
-
-