Spring-Camel(默认情况下骆驼日志进入控制台附加程序) [英] Spring-Camel (camel logs by default goes console appender)

查看:24
本文介绍了Spring-Camel(默认情况下骆驼日志进入控制台附加程序)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我面临一个奇怪的问题,我正在使用以下技术堆栈处理一个批处理应用程序Spring(IOC 容器)、spring batch、Hibernate、camel 和 Log4J 用于日志记录我只为文件 appender 配置了 log4J,我的所有应用程序日志都转到了我的日志文件,但奇怪的是所有 Camel 日志都转到了控制台 appender(我的 log4J 属性文件上没有配置控制台 appender)

I am facing one strange problem , I am working on one batch application using below tech STACK Spring (IOC container) , spring batch , Hibernate , camel and Log4J for logging I have configured log4J for file appender only and my all application logs goes to my log file , but strange thing is that all Camel logs goes to console appender (I have no console apender configured on my log4J properties file)

Spring – Camel 集成是 XMl 元素:

 <camelContext xmlns="http://camel.apache.org/schema/spring">
        <routeBuilder ref="smtBatchRouter" />
    </camelContext>

我的 Log4J 配置:

log4j.rootLogger=TRACE, file
log4j.logger.org.apache=TRACE
log4j.logger.org.directwebremoting=OFF
log4j.logger.org.hibernate=OFF
log4j.logger.org.springframework=WARN

log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
log4j.appender.file.file=myapp.log
log4j.appender.file.ImmediateFlush=true
log4j.appender.file.bufferedIO=false
log4j.appender.file.DatePattern='.' dd-MM-yyyy
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
log4j.appender.file.threshold=TRACE

我在控制台中获取的示例骆驼日志:

[main] INFO org.apache.camel.spring.SpringCamelContext - Apache Camel 2.11.0 (CamelContext: camel-1) started in 4.009 seconds
[Camel (camel-1) thread #0 - sftp://xyz.com/smtDataFolder] INFO org.apache.camel.component.file.remote.SftpOperations - JSCH -> Connecting to localhost port 22
[Camel (camel-1) thread #0 - sftp://xyz.com/smtDataFolder] INFO org.apache.camel.component.file.remote.SftpOperations - JSCH -> Connection established
[Camel (camel-1) thread #0 - sftp://xyz.com/smtDataFolder] INFO org.apache.camel.component.file.remote.SftpOperations - JSCH -> Remote version string: SSH-1.99-OpenSSH_4.6

推荐答案

我遇到了同样的问题并已解决.使用以下标志运行您的应用程序:
-Dlog4j.debug
它会将诊断信息添加到您的控制台.在我的情况下是

I had the same issue and solved it. Run your application with the flag:
-Dlog4j.debug
It will add diagnostic information to your console. In my case it was

SLF4J: Class path contains multiple SLF4J bindings. 

所以我只是删除了多余的slf4j-jdk14-1.7.9.jar,只留下了slf4j-log4j12-1.7.19.jar.

So I just deleted redundant slf4j-jdk14-1.7.9.jar and left only slf4j-log4j12-1.7.19.jar.

这篇关于Spring-Camel(默认情况下骆驼日志进入控制台附加程序)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆