RASILogger/code> defines the methods which are common to
objects that wish to create RAS message and trace data. This interface
is intended to be extended to include methods specific to the creation
of message or trace data and should not be implemented directly.
An object which implements this interface may also wish to
implement RASIMaskChangeListener
.
- See Also:
RASIMessageLogger
,
RASITraceLogger
Method Summary |
void |
addHandler(RASIHandler handler)
Registers a RAS handler with this logger. |
java.util.Hashtable |
getConfig()
Gets the configuration of this object. |
java.util.Enumeration |
getHandlers()
Gets all of the handlers associated with this logger. |
boolean |
isLoggable(long type)
Determines if a log entry will be processed by the logger and any of
the handlers. |
boolean |
isSynchronous()
Determines if synchronous logging is in effect. |
void |
removeHandler(RASIHandler handler)
Removes a RAS handler from this logger. |
void |
setConfig(java.util.Hashtable ht)
Sets the configuration of this object. |
void |
setSynchronous(boolean flag)
Sets a flag that tells the logger whether to log data synchronously. |
getConfig
public java.util.Hashtable getConfig()
- Gets the configuration of this object.
- Specified by:
- getConfig in interface RASIObject
- Returns:
- A
Hashtable
containing the configuration.
This object inserts the following key/value pairs into the
configuration:
"isLogging" "true" if the logger is logging data;
otherwise, "false".
"isSync" "true" if the logger is logging
synchronously; otherwise, "false".
"server" The server.
"client" The client.
All values are Strings
.
The parent and extensions of this object may add additional keys.
setConfig
public void setConfig(java.util.Hashtable ht)
- Sets the configuration of this object. This method is used by a
RASManager
to initialize a RAS object. It should not
be necessary for an application to use this method.
- Specified by:
- setConfig in interface RASIObject
- Parameters:
ht
- A Hashtable
containing the configuration.
This object searches for the following keys:
"isLogging" "true" if the logger is logging data;
otherwise, "false".
"isSync" "true" if the logger is logging
synchronously; otherwise, "false".
"server" The server.
"client" The client.
All values are Strings
.
If a key is not found, that configuration element is not
updated.
The parent and extensions of this object may use additional keys.
addHandler
public void addHandler(RASIHandler handler)
- Registers a RAS handler with this logger. More than one handler
may be associated with a logger to direct the RAS data to multiple
destinations. If the handler is
null
or is already
registered, this method does nothing.
- Parameters:
handler
- A RAS handler.
removeHandler
public void removeHandler(RASIHandler handler)
- Removes a RAS handler from this logger. If the handler is
null
or is not registered, this method does nothing.
- Parameters:
handler
- A RAS handler.
getHandlers
public java.util.Enumeration getHandlers()
- Gets all of the handlers associated with this logger.
- Returns:
- An
Enumeration
of handlers. If no handlers
are registered, the Enumeration
is empty.
setSynchronous
public void setSynchronous(boolean flag)
- Sets a flag that tells the logger whether to log data synchronously.
When logging synchronously, the logger will wait for the handlers
to write a log entry before returning to the caller. Otherwise,
the log entry is passed to the handler and the logger returns.
- Parameters:
flag
- A boolean
set true
for
synchronous logging and false
otherwise.
isSynchronous
public boolean isSynchronous()
- Determines if synchronous logging is in effect.
When logging synchronously, the logger will wait for the handlers
to write a log entry before returning to the caller. Otherwise,
the log entry is passed to the handler and the logger returns.
- Returns:
true
for synchronous logging and
false
otherwise.
isLoggable
public boolean isLoggable(long type)
- Determines if a log entry will be processed by the logger and any of
the handlers. Wrapping a message or trace call with this method can
improve performance. Log entries that will not be processed need not
even be built. For example:
if (isLoggable(RASTraceEvent.TYPE_PUBLIC)
trace(RASTraceEvent.TYPE_PUBLIC...);
- Parameters:
type
- The type of the log entry. The set of possible values is
defined by the RASMessageEvent
or
RASITraceEvent TYPE_XXXX
constants.- Returns:
true
if the logger is enabled and at least one
handler will process the log entry; false
,
otherwise.