Datasheet

The properties on the MemoryHandler are listed in the following table.
Property Name Description Default Value
MemoryHandler.level Log level for the handler Level.INFO
MemoryHandler.filter
Filter to use undefined
MemoryHandler.size Size of the circular buffer (in bytes) 1,000
MemoryHandler.push Defines the push level the minimum Level.SEVERE
level that will cause messages to be
sent to the target handler
MemoryHandler.target Specifies the name of the target (undefined)
Handler class
The constructors create a
MemoryHandler with a default or specific configuration.
Constructor Description
MemoryHandler() Creates a MemoryHandler based on the configuration properties.
MemoryHandler(Handler Creates a MemoryHandler with a specified target handler, size of
target, int size, the buffer, and push level.
Level pushLevel)
The methods provided by the MemoryHandler create and configure the behavior of the memory handler.
Method Description
void publish(LogRecord Stores the record in the internal buffer, if it is loggable (see
record) isLoggable). If the level of the log record is greater than or equal
to the
pushLevel, all buffered records, including the current one,
are written to the target
Handler.
void close() Closes the handler and frees the associated resources. Also invokes
close on the target handler.
void flush() Causes a flush, which is different from a push. To actually write
the log records to a destination other than memory, a
push must be
performed.
Level getPushLevel() Returns the current push level.
boolean isLoggable Compares the log levels, and then runs the record through the filter
(LogRecord record) if one is defined. Whether or not the record will cause a push is
ignored by this method.
void push() Sends all records in the current buffer to the target handler, and
clears the buffer.
void setPushLevel(Level Sets a new push level.
newLevel)
51
Chapter 1: Key Java Language Features and Libraries
05_777106 ch01.qxp 11/28/06 10:43 PM Page 51