20390

Spring-Camel (camel logs by default goes console appender)

Question:

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)

<strong>Spring – Camel Integration is XMl element :</strong>

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

<strong>My Log4J configuration:</strong>

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

<strong>Sample Camel Log that I am getting in console :</strong>

[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

Answer1:

Have you checked Apache Camel docs - <a href="http://camel.apache.org/how-do-i-use-log4j.html" rel="nofollow">http://camel.apache.org/how-do-i-use-log4j.html</a>

Answer2:

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

SLF4J: Class path contains multiple SLF4J bindings.

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

Recommend

  • Stop log messages from appearing in the command line
  • Can't able to receive group chat messages using smack-android:4.1.4
  • Android TextureView OpenGLRenderer﹕ GL_INVALID_OPERATION
  • Issue with log4j log not writing to file
  • Infinispan with Spring, casting from cache failing
  • Turning off Quartz job logging
  • Does log4net support zeroconf?
  • How would you implement so each Test class logs output to a separate file?
  • Tomcat Save Log History
  • Does @Scheduler start a new thread?
  • Apache Camel - Receiving SOAP response with empty body
  • Spring AOP with Around advice and @annotation not working
  • Multiple apps in glassfish JUL logging to different log files?
  • Mockito : How to test my Dao with mocking?
  • Is there anything like ELMAH for Java? [duplicate]
  • How to change artifactory runtime scope to compile scope?
  • How to systematically add (decorate) some data to log
  • Configuring Logging for Grails Standalone App Runner
  • How should I share Maven DepdendencyManagement from multiple sources?
  • How create a log file appended with date and time using log4j in java?
  • Running in “deadlock” while doing streaming aggregations from Kafka
  • log4j - Empty log file -
  • log4cxx: configuring appender with arguments
  • Can you alter the output of %caller{0} in logback to mimic log4j %l specifier?
  • is it possible to have a new file for each new day with log4cXX
  • Log4j2 java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/type/TypeReference
  • how to implement a logger factory for jboss EAP 6.2 applications
  • Apache Flink Dynamically setting JVM_OPT env.java.opts
  • How to make Java compiler generate line numbers in compiled code
  • How to provide hyperlink in email pointing to a specific method inside gwt app (but not main page)
  • Exception handling as per java coding standards
  • unrecognized selector isPitched called
  • maven jboss-as:start A required class was missing … org/sonaty…/ArtifactResolutionException
  • Is there some graphical way to create my own configuration file on SonarLint?
  • Graphics.CopyFromScreen [Web application] + The handle is invalid
  • Spring Cloud Microservice Architecture Confusion
  • Problem deserializing objects from cache on MyBatis 3/Java
  • How can I send an e-mail from a vbs script
  • Is there a mandatory requirement to switch app.yaml?
  • UserPrincipal.Current returns apppool on IIS