|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.logging.Handler
java.util.logging.MemoryHandler
public class MemoryHandler
A Handler put the description of log events into a cycled memory
buffer.
Mostly this MemoryHandler just puts the given LogRecord
into the internal buffer and doesn't perform any formatting or any other process.
When the buffer is full, the earliest buffered records will be discarded.
Every MemoryHandler has a target handler, and push action can be
triggered so that all buffered records will be output to the target handler
and normally the latter will publish the records. After the push action, the
buffer will be cleared.
The push action can be triggered in three ways:
LogRecord is put into the internal buffer, and it has a level which is not less than the specified push level.MemoryHandler and call push method implicitly according to some criteria.
MemoryHandler will read following LogManager
properties for initialization, if given properties are not defined or has
invalid values, default value will be used.
Handler, defaults to Level.ALL.Filter
class name, defaults to no Filter.LogRecord, defaults to 1000.Handler, no default value, which means this property must be
specified either by property setting or by constructor.
| Constructor Summary | |
|---|---|
MemoryHandler()
Default constructor, construct and init a MemoryHandler using
LogManager properties or default values |
|
MemoryHandler(Handler target,
int size,
Level pushLevel)
Construct and init a MemoryHandler using given target, size
and push level, other properties using LogManager properties
or default values |
|
| Method Summary | |
|---|---|
void |
close()
Close this handler and target handler, free all associated resources |
void |
flush()
Call target handler to flush any buffered output. |
Level |
getPushLevel()
Return the push level. |
boolean |
isLoggable(LogRecord record)
Check if given LogRecord would be put into this
MemoryHandler's internal buffer. |
void |
publish(LogRecord record)
Put a given LogRecord into internal buffer. |
void |
push()
Triggers a push action to output all buffered records to the target handler, and the target handler will publish them. |
void |
setPushLevel(Level newLevel)
Set the push level. |
| Methods inherited from class java.util.logging.Handler |
|---|
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, initProperties, internalSetEncoding, internalSetFormatter, printInvalidPropMessage, reportError, setEncoding, setErrorManager, setFilter, setFormatter, setLevel |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MemoryHandler()
MemoryHandler using
LogManager properties or default values
public MemoryHandler(Handler target,
int size,
Level pushLevel)
MemoryHandler using given target, size
and push level, other properties using LogManager properties
or default values
target - the given Handler to outputsize - the maximum number of buffered LogRecordpushLevel - the push level
IllegalArgumentException - if size<=0| Method Detail |
|---|
public void close()
close in class HandlerSecurityException - if security manager exists and it determines that caller
does not have the required permissions to control this handlerpublic void flush()
MemoryHandler to push.
flush in class Handlerpublic void publish(LogRecord record)
LogRecord into internal buffer.
If given record is not loggable, just return. Otherwise it is stored in
the buffer. Furthermore if the record's level is not less than the push
level, the push action is triggered to output all the buffered records
to the target handler, and the target handler will publish them.
publish in class Handlerrecord - the log record.public Level getPushLevel()
public boolean isLoggable(LogRecord record)
Check if given LogRecord would be put into this
MemoryHandler's internal buffer.
The given LogRecord is loggable if and only if it has
appropriate level and it pass any associated filter's check.
Note that the push level is not used for this check.
isLoggable in class Handlerrecord - the given LogRecord
LogRecord should be loggedpublic void push()
public void setPushLevel(Level newLevel)
LogRecord is put into the internal
buffer and its level is not less than the push level, the push action
will be triggered. Note that set new push level won't trigger push action.
newLevel - the new level to set
SecurityException - if security manager exists and it determines that caller
does not have the required permissions to control this handler
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||