Class LogRecordListener


  • @API(status=INTERNAL,
         since="1.1")
    public class LogRecordListener
    extends Object
    LogRecordListener is only intended for testing purposes within JUnit's own test suite.
    Since:
    1.1
    • Constructor Detail

      • LogRecordListener

        public LogRecordListener()
    • Method Detail

      • logRecordSubmitted

        public void logRecordSubmitted​(LogRecord logRecord)
        Inform the listener of a LogRecord that was submitted to JUL for processing.
      • stream

        public Stream<LogRecord> stream()
        Get a stream of 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.

        See Also:
        stream(Level), stream(Class), stream(Class, Level)
      • stream

        public Stream<LogRecord> stream​(Level level)
        Get a stream of 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.

        Parameters:
        level - the log level for which to get the log records; never null
        Since:
        1.4
        See Also:
        stream(), stream(Class), stream(Class, Level)
      • stream

        public Stream<LogRecord> stream​(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.

        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.

        Parameters:
        clazz - the class for which to get the log records; never null
        See Also:
        stream(), stream(Level), stream(Class, Level)
      • stream

        public Stream<LogRecord> stream​(Class<?> clazz,
                                        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.

        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.

        Parameters:
        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
        See Also:
        stream(), stream(Level), stream(Class)
      • clear

        public void clear()
        Clear all existing log records that have been submitted to this listener by the current thread.