How to use logging-channel-adapter in Spring Integration to log a message header value -


I need to log the value of the message header with the key "foo_bar" so that the log message will appear something like that header The value is "baz":

The value of the header foo_bar: baz

Is it wire-tapping and logging-channel-adapter?

Use the logging-channel-adapter expression feature and set the wire-tapping and logging-channel - Adapter something like this:

  & lt; Integration: Channel ID = "Channel 1" & gt; & Lt; Integration: Interceptor & gt; & Lt; Integration: Wire-Channel = "Logging Channel 1" /> & Lt; / Integration: Interceptor & gt; & Lt; / Integration: Channels & gt; & Lt; Integration: Logging-Channel-Adapter ID = "Logging Channel 1" expression = "Header value foo_bar: '.concat (headers.foo_bar)" level = "debug" />   

When using the expression attribute, the root object is the spring integration message. So in the expression "Header" gets you the header map of the message.

Comments