SLF4J Channel Adapter

The slf4j adapter is a sink that logs the message payload through the SLF4J API. It is useful for debugging, auditing, and logging intermediate outputs.

Availability

Included in default-channel-adapters, transitively available with pipelite-core.

Usage as sink

.toSink("slf4j://my-logger")

The Slf4jProducer logs the output Exchange payload at INFO level using the logger named after the URL.

URL format

slf4j://<logger-name>
Parameter Description

logger-name

SLF4J logger name (e.g. my-loggerLoggerFactory.getLogger("my-logger"))

Usage in WireTap

The SLF4J adapter is particularly useful as a WireTap destination for audit logging:

.wireTap("audit-tap", "slf4j://audit-logger")
.toSink("kafka://output-topic")

In this case the Exchange is logged by SLF4J while simultaneously being sent to Kafka.

The slf4j adapter is exclusively a sink: it does not support use as a flow source.