java.lang.Object | ||
↳ | java.util.logging.Handler | |
↳ | java.util.logging.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 method can be called directly, but will also be called automatically
if a new LogRecord
is added that has a level greater than or
equal to than the value defined for the property
java.util.logging.MemoryHandler.push.
MemoryHandler
will read following LogManager
properties for
initialization, if given properties are not defined or has invalid values,
default value will be used.
Filter
class name, defaults to no Filter
.Handler
, defaults to Level.ALL
.LogRecord
, defaults to 1000.Handler
, no default value, which means this property must be
specified either by property setting or by constructor.Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Default constructor, construct and init a
MemoryHandler using
LogManager properties or default values. | |||||||||||
Construct and init a
MemoryHandler using given target, size and
push level, other properties using LogManager properties or
default values. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Close this handler and target handler, free all associated resources.
| |||||||||||
Call target handler to flush any buffered output.
| |||||||||||
Return the push level.
| |||||||||||
Check if given
LogRecord would be put into this
MemoryHandler 's internal buffer. | |||||||||||
Put a given
LogRecord into internal buffer. | |||||||||||
Triggers a push action to output all buffered records to the target handler,
and the target handler will publish them.
| |||||||||||
Set the push level.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.util.logging.Handler
| |||||||||||
From class
java.lang.Object
|
Default constructor, construct and init a MemoryHandler
using
LogManager
properties or default values.
RuntimeException | if property value are invalid and no default value could be used. |
---|
Construct and init a MemoryHandler
using given target, size and
push level, other properties using LogManager
properties or
default values.
target | the given Handler to output |
---|---|
size | the maximum number of buffered LogRecord , greater than
zero |
pushLevel | the push level |
IllegalArgumentException | if size <= 0 |
---|---|
RuntimeException | if property value are invalid and no default value could be used. |
Close this handler and target handler, free all associated resources.
Call target handler to flush any buffered output. Note that this doesn't
cause this MemoryHandler
to push.
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.
record | the given LogRecord |
---|
LogRecord
if it should be logged, false
if LogRecord
is null
.
Put a given 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.
record | the log record |
---|
Triggers a push action to output all buffered records to the target handler, and the target handler will publish them. Then the buffer is cleared.
Set the push level. The push level is used to check the push action
triggering. When a new 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. |
---|