Class EventLoggingInterceptor
java.lang.Object
org.axonframework.eventhandling.interceptors.EventLoggingInterceptor
- All Implemented Interfaces:
MessageDispatchInterceptor<EventMessage<?>>
public class EventLoggingInterceptor
extends Object
implements MessageDispatchInterceptor<EventMessage<?>>
Message Dispatch Interceptor that logs published events to a SLF4J logger. It does not alter or reject events.
The interceptor also logs the cause of the published events. E.g. if the cause of the events is a command, the
interceptor also logs the command and the execution result of the command.
The interceptor allows for configuration of the name under which the logger should log the statements. All logging
is done at the
INFO level.- Since:
- 3.0
- Author:
- Rene de Waele
-
Constructor Summary
ConstructorsConstructorDescriptionInitialize the LoggingInterceptor with the default logger name, which is the fully qualified class name of this logger.EventLoggingInterceptor(String loggerName) Initialize the interceptor with the givenloggerName. -
Method Summary
Modifier and TypeMethodDescriptionhandle(List<? extends EventMessage<?>> messages) Apply this interceptor to the given list ofmessages.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.axonframework.messaging.MessageDispatchInterceptor
handle
-
Constructor Details
-
EventLoggingInterceptor
public EventLoggingInterceptor()Initialize the LoggingInterceptor with the default logger name, which is the fully qualified class name of this logger.- See Also:
-
EventLoggingInterceptor
Initialize the interceptor with the givenloggerName. The actual logging implementation will use this name to decide the appropriate log level and location. See the documentation of your logging implementation for more information.- Parameters:
loggerName- the name of the logger
-
-
Method Details
-
handle
@Nonnull public BiFunction<Integer,EventMessage<?>, handleEventMessage<?>> (@Nonnull List<? extends EventMessage<?>> messages) Description copied from interface:MessageDispatchInterceptorApply this interceptor to the given list ofmessages. This method returns a function that can be invoked to obtain a modified version of messages at each position in the list.- Specified by:
handlein interfaceMessageDispatchInterceptor<EventMessage<?>>- Parameters:
messages- The Messages to pre-process- Returns:
- a function that processes messages based on their position in the list
-