Reputation: 301
I want to print message log in the console and write in a log file. I am trying with logging-channel-adapter, LoggingHandler please give me sample code. Thank you
Upvotes: 1
Views: 3685
Reputation: 174514
Use one of the .log()
operators.
For convenience, to log the message journey through the Spring Integration flow (), a log() operator is presented. Internally, it is represented by the WireTap ChannelInterceptor with a LoggingHandler as its subscriber. It is responsible for logging the incoming message into the next endpoint or the current channel. The following example shows how to use LoggingHandler:
.filter(...)
.log(LoggingHandler.Level.ERROR, "test.category", m -> m.getHeaders().getId())
.route(...)
Upvotes: 2