Class LogRecordListener



  • @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.
    Since:
    1.1
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear​()
      Clear all existing log records that have been submitted to this listener.
      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.
      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 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 for the logger name equal to the name of the given class at the given log level.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LogRecordListener

        public LogRecordListener​()
    • Method Detail

      • logRecordSubmitted

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

        public java.util.stream.Stream<java.util.logging.LogRecord> stream​()
        Get a stream of log records that have been submitted to this listener.

        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

        public 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 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
      • stream

        public 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 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
      • clear

        public void clear​()
        Clear all existing log records that have been submitted to this listener.