@API(status=INTERNAL,
since="1.1")
public class LogRecordListener
extends java.lang.Object
LogRecordListener
is only intended for testing purposes within
JUnit's own test suite.Modifier and Type | Field and Description |
---|---|
private java.lang.ThreadLocal<java.util.List<java.util.logging.LogRecord>> |
logRecords |
Constructor and Description |
---|
LogRecordListener() |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear all existing
log records that have been
submitted to this listener by the
current thread. |
void |
logRecordSubmitted(java.util.logging.LogRecord logRecord)
Inform the listener of a
LogRecord that was submitted to JUL for
processing. |
java.util.stream.Stream<java.util.logging.LogRecord> |
stream()
Get a stream of
log records that have been
submitted to this listener by the
current thread. |
java.util.stream.Stream<java.util.logging.LogRecord> |
stream(java.lang.Class<?> clazz)
Get a stream of
log records that have been
submitted to this listener by the current
thread for the logger name equal to the name of the given class. |
java.util.stream.Stream<java.util.logging.LogRecord> |
stream(java.lang.Class<?> clazz,
java.util.logging.Level level)
Get a stream of
log records that have been
submitted to this listener by the current
thread for the logger name equal to the name of the given class at the given
log level. |
java.util.stream.Stream<java.util.logging.LogRecord> |
stream(java.util.logging.Level level)
Get a stream of
log records that have been
submitted to this listener by the current
thread at the given log level. |
private final java.lang.ThreadLocal<java.util.List<java.util.logging.LogRecord>> logRecords
public void logRecordSubmitted(java.util.logging.LogRecord logRecord)
LogRecord
that was submitted to JUL for
processing.public java.util.stream.Stream<java.util.logging.LogRecord> stream()
log records
that have been
submitted to this listener by the
current thread.
As stated in the Javadoc for LogRecord
, a submitted
LogRecord
should not be updated by the client application. Thus,
the LogRecords
in the returned stream should only be inspected for
testing purposes and not modified in any way.
stream(Level)
,
stream(Class)
,
stream(Class, Level)
public java.util.stream.Stream<java.util.logging.LogRecord> stream(java.util.logging.Level level)
log records
that have been
submitted to this listener by the current
thread at the given log level.
As stated in the Javadoc for LogRecord
, a submitted
LogRecord
should not be updated by the client application. Thus,
the LogRecords
in the returned stream should only be inspected for
testing purposes and not modified in any way.
level
- the log level for which to get the log records; never null
stream()
,
stream(Class)
,
stream(Class, Level)
public java.util.stream.Stream<java.util.logging.LogRecord> stream(java.lang.Class<?> clazz)
log records
that have been
submitted to this listener by the current
thread for the logger name equal to the name of the given class.
As stated in the Javadoc for LogRecord
, a submitted
LogRecord
should not be updated by the client application. Thus,
the LogRecords
in the returned stream should only be inspected for
testing purposes and not modified in any way.
clazz
- the class for which to get the log records; never null
stream()
,
stream(Level)
,
stream(Class, Level)
public java.util.stream.Stream<java.util.logging.LogRecord> stream(java.lang.Class<?> clazz, java.util.logging.Level level)
log records
that have been
submitted to this listener by the current
thread for the logger name equal to the name of the given class at the given
log level.
As stated in the Javadoc for LogRecord
, a submitted
LogRecord
should not be updated by the client application. Thus,
the LogRecords
in the returned stream should only be inspected for
testing purposes and not modified in any way.
clazz
- the class for which to get the log records; never null
level
- the log level for which to get the log records; never null
stream()
,
stream(Level)
,
stream(Class)
public void clear()
log records
that have been
submitted to this listener by the
current thread.