我正在尝试添加窃听来拦截 channel ,但它没有使用我的 logback 配置,而是使用 org.apache.commons.logging.impl.Jdk14Logger。 如何告诉 LoggingHandler.messageLogger 使用 lmy logback 配置?
<int:channel id="testChannel">
<int:interceptors>
<int:wire-tap channel="loggerChannel"/>
</int:interceptors>
</int:channel>
<int:logging-channel-adapter id="loggerChannel" level="DEBUG"/>
我的 logback 定义了以下配置
<logger name="org.springframework" level="DEBUG"/>
<logger name="org.springframework.integration" level="DEBUG"/>
<logger name="org.springframework.integration.handler.LoggingHandler" level="DEBUG"/>
<root level="DEBUG">
<appender-ref ref="STDOUT"/>
<appender-ref ref="ROLLING"/>
</root>
最佳答案
由于历史原因,Spring内部使用commons-logging;您可以使用 slf4j 连接 logback。
请参阅note in the Spring Reference .
这是another howto .
本质上,您需要从 spring deps 中排除 commons-logging
并添加 jcl-over-slf4j
。
关于spring-integration - Spring集成窃听和日志记录 channel 适配器日志记录问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28860477/