akka.testkit

EventFilter

object EventFilter

Facilities for selectively filtering out expected events from logging so that you can keep your test run’s console output clean and do not miss real error messages.

Also have a look at the akka.testkit package object’s filterEvents and filterException methods.

The source filters do accept Class[_] arguments, matching any object which is an instance of the given class, e.g.

EventFilter.info(source = classOf[MyActor]) // will match Info events from any MyActor instance

The message object will be converted to a string before matching ("null" if it is null).

Source
TestEventListener.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. EventFilter
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. def apply[A <: Throwable](message: String = null, source: String = null, start: String = "", pattern: String = null, occurrences: Int = Int.MaxValue)(implicit arg0: ClassTag[A]): EventFilter

    Create a filter for Error events.

    Create a filter for Error events. Give up to one of start and pattern:

    EventFilter[MyException]()                                         // filter only on exception type
    EventFilter[MyException]("message")                                // filter on exactly matching message
    EventFilter[MyException](source = obj)                             // filter on event source
    EventFilter[MyException](start = "Expected")                       // filter on start of message
    EventFilter[MyException](source = obj, pattern = "weird.*message") // filter on pattern and message

    Please note that filtering on the source being null does NOT work (passing null disables the source filter).

  7. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  8. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. def custom(test: PartialFunction[LogEvent, Boolean], occurrences: Int = Int.MaxValue): EventFilter

    Create a custom event filter.

    Create a custom event filter. The filter will affect those events for which the supplied partial function is defined and returns true.

    EventFilter.custom {
    case Warning(ref, "my warning") if ref == actor || ref == null => true
    }
  10. def debug(message: String = null, source: String = null, start: String = "", pattern: String = null, occurrences: Int = Int.MaxValue): EventFilter

    Create a filter for Debug events.

    Create a filter for Debug events. Give up to one of start and pattern:

    EventFilter.debug()                                         // filter only on exception type
    EventFilter.debug(source = obj)                             // filter on event source
    EventFilter.debug(start = "Expected")                       // filter on start of message
    EventFilter.debug(source = obj, pattern = "weird.*message") // filter on pattern and message

    Please note that filtering on the source being null does NOT work (passing null disables the source filter).

  11. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  12. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  13. def error(message: String = null, source: String = null, start: String = "", pattern: String = null, occurrences: Int = Int.MaxValue): EventFilter

    Create a filter for Error events which do not have a cause set (i.

    Create a filter for Error events which do not have a cause set (i.e. use implicitly supplied Logging.Error.NoCause). See apply() for more details.

  14. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  15. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  16. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  17. def info(message: String = null, source: String = null, start: String = "", pattern: String = null, occurrences: Int = Int.MaxValue): EventFilter

    Create a filter for Info events.

    Create a filter for Info events. Give up to one of start and pattern:

    EventFilter.info()                                         // filter only on exception type
    EventFilter.info(source = obj)                             // filter on event source
    EventFilter.info(start = "Expected")                       // filter on start of message
    EventFilter.info(source = obj, pattern = "weird.*message") // filter on pattern and message

    Please note that filtering on the source being null does NOT work (passing null disables the source filter).

  18. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  19. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  20. final def notify(): Unit

    Definition Classes
    AnyRef
  21. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  22. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  23. def toString(): String

    Definition Classes
    AnyRef → Any
  24. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  25. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  26. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  27. def warning(message: String = null, source: String = null, start: String = "", pattern: String = null, occurrences: Int = Int.MaxValue): EventFilter

    Create a filter for Warning events.

    Create a filter for Warning events. Give up to one of start and pattern:

    EventFilter.warning()                                         // filter only on exception type
    EventFilter.warning(source = obj)                             // filter on event source
    EventFilter.warning(start = "Expected")                       // filter on start of message
    EventFilter.warning(source = obj, pattern = "weird.*message") // filter on pattern and message

    Please note that filtering on the source being null does NOT work (passing null disables the source filter).

Inherited from AnyRef

Inherited from Any

Ungrouped