public class LoggerBase extends Object implements Lifecycle, Logger
log(String msg)
, plus
any property setting and lifecycle methods required for configuration.Modifier and Type | Field and Description |
---|---|
protected Container |
container
The Container with which this Logger has been associated.
|
protected ObjectName |
controller |
protected int |
debug
The debugging detail level for this component.
|
protected static String |
info
The descriptive information about this implementation.
|
protected LifecycleSupport |
lifecycle
The lifecycle event support for this component.
|
protected static Logger |
log |
protected ObjectName |
oname |
protected static ResourceBundle |
rb |
protected PropertyChangeSupport |
support
The property change support for this component.
|
protected int |
verbosity
The verbosity level for above which log messages may be filtered.
|
AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, INIT_EVENT, START_EVENT, STOP_EVENT
Constructor and Description |
---|
LoggerBase() |
Modifier and Type | Method and Description |
---|---|
void |
addHandler(Handler handler) |
void |
addLifecycleListener(LifecycleListener listener)
Add a lifecycle event listener to this component.
|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Add a property change listener to this component.
|
ObjectName |
createObjectName() |
void |
destroy() |
List<LifecycleListener> |
findLifecycleListeners()
Gets the (possibly empty) list of lifecycle listeners
associated with this LoggerBase.
|
Container |
getContainer()
Return the Container with which this Logger has been associated.
|
ObjectName |
getController() |
int |
getDebug()
Return the debugging detail level for this component.
|
String |
getInfo()
Return descriptive information about this Logger implementation and
the corresponding version number, in the format
<description>/<version> . |
ObjectName |
getObjectName() |
int |
getVerbosity()
Return the verbosity level of this logger.
|
void |
init() |
void |
log(Exception exception,
String msg)
Writes the specified exception, and message, to a servlet log file.
|
void |
log(String msg)
Writes the specified message to a servlet log file, usually an event
log.
|
void |
log(String message,
int verbosity)
Writes the specified message to the servlet log file, usually an event
log, if the logger is set to a verbosity level equal to or higher than
the specified value for this message.
|
void |
log(String msg,
Throwable throwable)
Writes an explanatory message and a stack trace for a given
Throwable exception to the servlet log file. |
void |
log(String message,
Throwable throwable,
int verbosity)
Writes the specified message and exception to the servlet log file,
usually an event log, if the logger is set to a verbosity level equal
to or higher than the specified value for this message.
|
void |
removeLifecycleListener(LifecycleListener listener)
Remove a lifecycle event listener from this component.
|
void |
removePropertyChangeListener(PropertyChangeListener listener)
Remove a property change listener from this component.
|
void |
setContainer(Container container)
Set the Container with which this Logger has been associated.
|
void |
setController(ObjectName controller) |
void |
setDebug(int debug)
Set the debugging detail level for this component.
|
void |
setLevel(String logLevel)
Set the verbosity level of this logger.
|
void |
setVerbosity(int verbosity)
Set the verbosity level of this logger.
|
void |
setVerbosityLevel(String verbosity)
Set the verbosity level of this logger.
|
void |
start()
Prepare for the beginning of active use of the public methods of this
component.
|
void |
stop()
Gracefully terminate the active use of the public methods of this
component.
|
protected static final Logger log
protected static final ResourceBundle rb
protected Container container
protected int debug
protected static final String info
protected LifecycleSupport lifecycle
protected PropertyChangeSupport support
protected int verbosity
protected ObjectName oname
protected ObjectName controller
public Container getContainer()
getContainer
in interface Logger
public void setContainer(Container container)
setContainer
in interface Logger
container
- The associated Containerpublic int getDebug()
public void setDebug(int debug)
debug
- The new debugging detail levelpublic String getInfo()
<description>/<version>
.public int getVerbosity()
getVerbosity
in interface Logger
public void setVerbosity(int verbosity)
setVerbosity
in interface Logger
verbosity
- The new verbosity levelpublic void setVerbosityLevel(String verbosity)
verbosityLevel
- The new verbosity level, as a stringpublic void setLevel(String logLevel)
verbosityLevel
- The new verbosity level, as a stringpublic void addHandler(Handler handler)
public void addPropertyChangeListener(PropertyChangeListener listener)
addPropertyChangeListener
in interface Logger
listener
- The listener to addpublic void log(String msg)
public void log(Exception exception, String msg)
log(msg, exception)
instead. This method is deprecated
in the ServletContext interface, but not deprecated here to avoid
many useless compiler warnings. This message will be logged
unconditionally.public void log(String msg, Throwable throwable)
Throwable
exception to the servlet log file. The name
and type of the servlet log file is specific to the servlet container,
usually an event log. This message will be logged unconditionally.public void log(String message, int verbosity)
public void log(String message, Throwable throwable, int verbosity)
public void removePropertyChangeListener(PropertyChangeListener listener)
removePropertyChangeListener
in interface Logger
listener
- The listener to removepublic ObjectName getController()
public void setController(ObjectName controller)
public ObjectName getObjectName()
public void init()
public void destroy()
public ObjectName createObjectName()
public void addLifecycleListener(LifecycleListener listener)
addLifecycleListener
in interface Lifecycle
listener
- The listener to addpublic List<LifecycleListener> findLifecycleListeners()
findLifecycleListeners
in interface Lifecycle
public void removeLifecycleListener(LifecycleListener listener)
removeLifecycleListener
in interface Lifecycle
listener
- The listener to addpublic void start() throws LifecycleException
configure()
,
and before any of the public methods of the component are utilized.start
in interface Lifecycle
LifecycleException
- if this component detects a fatal error
that prevents this component from being usedpublic void stop() throws LifecycleException
stop
in interface Lifecycle
LifecycleException
- if this component detects a fatal error
that needs to be reportedCopyright © 2019. All rights reserved.