Class InMemoryAppender
java.lang.Object
ch.qos.logback.core.spi.ContextAwareBase
ch.qos.logback.core.AppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
org.kiwiproject.beta.test.logback.InMemoryAppender
- All Implemented Interfaces:
ch.qos.logback.core.Appender<ch.qos.logback.classic.spi.ILoggingEvent>,ch.qos.logback.core.spi.ContextAware,ch.qos.logback.core.spi.FilterAttachable<ch.qos.logback.classic.spi.ILoggingEvent>,ch.qos.logback.core.spi.LifeCycle
@Beta
public class InMemoryAppender
extends ch.qos.logback.core.AppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
A logback appender that stores logging events in an in-memory map.
This is for testing purposes only, and is not at all intended for production use!
-
Field Summary
Fields inherited from class ch.qos.logback.core.AppenderBase
name, startedFields inherited from class ch.qos.logback.core.spi.ContextAwareBase
context -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidappend(ch.qos.logback.classic.spi.ILoggingEvent eventObject) voidClear all the events that are stored in-memory.Return a copy of the internal event map.Return the logged messages.List<ch.qos.logback.classic.spi.ILoggingEvent>Return the loggedILoggingEventinstances.Stream<ch.qos.logback.classic.spi.ILoggingEvent>Return a stream containing the logged events.Methods inherited from class ch.qos.logback.core.AppenderBase
addFilter, clearAllFilters, doAppend, getCopyOfAttachedFiltersList, getFilterChainDecision, getName, isStarted, setName, start, stop, toStringMethods inherited from class ch.qos.logback.core.spi.ContextAwareBase
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ch.qos.logback.core.spi.ContextAware
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContext
-
Constructor Details
-
InMemoryAppender
public InMemoryAppender()
-
-
Method Details
-
append
protected void append(ch.qos.logback.classic.spi.ILoggingEvent eventObject) - Specified by:
appendin classch.qos.logback.core.AppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
-
clearEvents
public void clearEvents()Clear all the events that are stored in-memory. -
getEventMap
Return a copy of the internal event map. The keys are the message order starting at one, and the values are the corresponding logging events.- Returns:
- an unmodifiable copy of the event map
-
getOrderedEvents
Return the loggedILoggingEventinstances.- Returns:
- a list containing the logged events
-
getOrderedEventMessages
Return the logged messages.- Returns:
- a list containing the logged event messages
-
getOrderedEventStream
Return a stream containing the logged events.- Returns:
- a stream of the logged events
-