diff --git a/src/reference/asciidoc/logging-adapter.adoc b/src/reference/asciidoc/logging-adapter.adoc index e822932fc1..f3fd8664f2 100644 --- a/src/reference/asciidoc/logging-adapter.adoc +++ b/src/reference/asciidoc/logging-adapter.adoc @@ -58,11 +58,6 @@ public class LoggingJavaApplication { gateway.sendToLogger("foo"); } - @Bean - public MessageChannel logInputChannel() { - return new DirectChannel(); - } - @Bean @ServiceActivator(inputChannel = "logChannel") public LoggingHandler logging() { @@ -81,3 +76,38 @@ public class LoggingJavaApplication { } ---- + +==== Configuring with the Java DSL + +The following Spring Boot application provides an example of configuring the logging channel adapter using the Java DSL: + +[source, java] +---- +@SpringBootApplication +public class LoggingJavaApplication { + + public static void main(String[] args) { + ConfigurableApplicationContext context = + new SpringApplicationBuilder(LoggingJavaApplication.class) + .web(false) + .run(args); + MyGateway gateway = context.getBean(MyGateway.class); + gateway.sendToLogger("foo"); + } + + @Bean + public IntegrationFlow loggingFlow() { + return IntegrationFlows.from(MyGateway.class) + .log(LoggingHandler.Level.DEBUG, "TEST_LOGGER", + m -> m.getHeaders().getId() + ": " + m.getPayload()); + } + + @MessagingGateway + public interface MyGateway { + + void sendToLogger(String data); + + } + +} +---- \ No newline at end of file