- All Implemented Interfaces and Traits:
- HandlerEnhancerDefinition
@CompileStatic
class LoggingEventHandlerEnhancerDefinition
extends Object
implements HandlerEnhancerDefinition
Defines Axon's HandlerEnhancerDefinition for detailed logging of event handlers executions.
Corresponding Slf4j logger uses 'cargotracking-lib-axon-logging.event-handler-logger
' category and it logs on DEBUG
level. Logger output contains information about
aggregate identifier, sequence number, global index and event id.
Logged output looks similar to this (single line in output):
... cargotracking-lib-axon-logging.event-handler-logger : Executing EventHandler method [BookingOfferSummaryProjectionService.onBookingOfferCreatedEvent(BookingOfferCreatedEvent)]
with event [eventGlobalIndex: 6, eventId: 76e6ea70-4fd8-47f9-a15b-ce8df4a939e2, BookingOfferCreatedEvent(aggregateIdentifier: eaa1efa4-ff9d-4bd8-8e83-4e4b2c1bbcfb, sequenceNumber: 0)]
To register this HandlerEnhancerDefinition, use standard means as described in Axon documentation. Usually this will require adding a simple bean declaration in the Spring Boot config. However,
if you have standalone projection app EventHandler
annotations are present (not a single CommandHandler
or QueryHandler
are present), only option at the moment
is to specify handler enhancer definition's fully qualified class name in META-INF/services/org.axonframework.messaging.annotation.HandlerEnhancerDefinition
.
Logger output contains information about aggregate identifier and sequence number which enables easy correlation with logging outputs produced by LoggingCommandHandlerEnhancerDefinition
and LoggingEventSourcingHandlerEnhancerDefinition.