Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
登录spring集成JavaDSL_Java_Spring_Logging_Spring Integration_Spring Integration Dsl - Fatal编程技术网

登录spring集成JavaDSL

登录spring集成JavaDSL,java,spring,logging,spring-integration,spring-integration-dsl,Java,Spring,Logging,Spring Integration,Spring Integration Dsl,我想在控制台中打印消息日志并写入日志文件。我正在尝试使用日志通道适配器LoggingHandler 请给我样本代码。 谢谢你 为了方便起见,为了记录通过Spring集成流的消息旅程,提供了一个log操作符。在内部,它由WireTap ChannelInterceptor表示,其订户为LoggingHandler。它负责将传入消息记录到下一个端点或当前通道中。以下示例显示如何使用LoggingHandler: 谢谢你的回答。它起作用了。剩下的一件事是,我想把这个日志写入一个文件。请提供帮助。您应该

我想在控制台中打印消息日志并写入日志文件。我正在尝试使用日志通道适配器LoggingHandler 请给我样本代码。 谢谢你

为了方便起见,为了记录通过Spring集成流的消息旅程,提供了一个log操作符。在内部,它由WireTap ChannelInterceptor表示,其订户为LoggingHandler。它负责将传入消息记录到下一个端点或当前通道中。以下示例显示如何使用LoggingHandler:


谢谢你的回答。它起作用了。剩下的一件事是,我想把这个日志写入一个文件。请提供帮助。您应该查阅日志子系统文档log4j、logback等。通常,您会配置一个文件追加器,然后在上面的示例中配置日志类别test.category以使用文件追加器。
.filter(...)
.log(LoggingHandler.Level.ERROR, "test.category", m -> m.getHeaders().getId())
.route(...)