Log4J2 Pattern Layout not picking up Pattern - maven

I have set up a service to use SLF4J and Log4j2 but I am unable to get the specified logs in the pattern layout specified. My dependencies are:
log4j-slf4j-impl: 2.17.2
slf4j-api: 1.7.36
When I boot my service with -Dlog4j2.debug, I see the following:
DEBUG StatusLogger PluginManager 'Lookup' found 16 plugins
DEBUG StatusLogger null null initializing configuration org.apache.logging.log4j.core.config.properties.PropertiesConfiguration#2f5ac102
DEBUG StatusLogger PluginManager 'Core' found 128 plugins
DEBUG StatusLogger PluginManager 'Level' found 0 plugins
DEBUG StatusLogger PluginManager 'Lookup' found 16 plugins
DEBUG StatusLogger Building Plugin[name=AppenderRef, class=org.apache.logging.log4j.core.config.AppenderRef].
TRACE StatusLogger TypeConverterRegistry initializing.
DEBUG StatusLogger PluginManager 'TypeConverter' found 26 plugins
DEBUG StatusLogger createAppenderRef(ref="STDOUT", level="null", Filter=null)
DEBUG StatusLogger Building Plugin[name=root, class=org.apache.logging.log4j.core.config.LoggerConfig$RootLogger].
DEBUG StatusLogger LoggerConfig$RootLogger$Builder(additivity="null", level="INFO", levelAndRefs="null", includeLocation="null", ={STDOUT}, ={}, Configuration(PropertiesConfig), Filter=null)
DEBUG StatusLogger Building Plugin[name=loggers, class=org.apache.logging.log4j.core.config.LoggersPlugin].
DEBUG StatusLogger createLoggers(={root})
DEBUG StatusLogger Building Plugin[name=layout, class=org.apache.logging.log4j.core.layout.PatternLayout].
DEBUG StatusLogger PatternLayout$Builder(pattern="[%p] %d [%t] %c %M - %m%n", PatternSelector=null, Configuration(PropertiesConfig), Replace=null, charset="null", alwaysWriteExceptions="null", disableAnsi="null", noConsoleNoAnsi="null", header="null", footer="null")
DEBUG StatusLogger PluginManager 'Converter' found 45 plugins
DEBUG StatusLogger Building Plugin[name=appender, class=org.apache.logging.log4j.core.appender.ConsoleAppender].
DEBUG StatusLogger ConsoleAppender$Builder(target="SYSTEM_OUT", follow="null", direct="null", bufferedIo="null", bufferSize="null", immediateFlush="null", ignoreExceptions="null", PatternLayout([%p] %d [%t] %c %M - %m%n), name="STDOUT", Configuration(PropertiesConfig), Filter=null, ={})
DEBUG StatusLogger Starting OutputStreamManager SYSTEM_OUT.false.false
DEBUG StatusLogger Building Plugin[name=appenders, class=org.apache.logging.log4j.core.config.AppendersPlugin].
DEBUG StatusLogger createAppenders(={STDOUT})
DEBUG StatusLogger Configuration org.apache.logging.log4j.core.config.properties.PropertiesConfiguration#2f5ac102 initialized
DEBUG StatusLogger Starting configuration org.apache.logging.log4j.core.config.properties.PropertiesConfiguration#2f5ac102
DEBUG StatusLogger Started configuration org.apache.logging.log4j.core.config.properties.PropertiesConfiguration#2f5ac102 OK.
TRACE StatusLogger Stopping org.apache.logging.log4j.core.config.DefaultConfiguration#3c69362a...
TRACE StatusLogger DefaultConfiguration notified 1 ReliabilityStrategies that config will be stopped.
TRACE StatusLogger DefaultConfiguration stopping root LoggerConfig.
TRACE StatusLogger DefaultConfiguration notifying ReliabilityStrategies that appenders will be stopped.
TRACE StatusLogger DefaultConfiguration stopping remaining Appenders.
DEBUG StatusLogger Shutting down OutputStreamManager SYSTEM_OUT.false.false-1
DEBUG StatusLogger OutputStream closed
DEBUG StatusLogger Shut down OutputStreamManager SYSTEM_OUT.false.false-1, all resources released: true
DEBUG StatusLogger Appender DefaultConsole-1 stopped with status true
TRACE StatusLogger DefaultConfiguration stopped 1 remaining Appenders.
TRACE StatusLogger DefaultConfiguration cleaning Appenders from 1 LoggerConfigs.
DEBUG StatusLogger Stopped org.apache.logging.log4j.core.config.DefaultConfiguration#3c69362a OK
TRACE StatusLogger Reregistering MBeans after reconfigure. Selector=org.apache.logging.log4j.core.selector.ClassLoaderContextSelector#5a1c3cb4
TRACE StatusLogger Using default SystemClock for timestamps.
DEBUG StatusLogger org.apache.logging.log4j.core.util.SystemClock does not support precise timestamps.
TRACE StatusLogger Using DummyNanoClock for nanosecond timestamps.
DEBUG StatusLogger Reconfiguration complete for context[name=Default] at URI jar:file:[redacted]/log4j2.properties (org.apache.logging.log4j.core.LoggerContext#78e22d35) with optional ClassLoader: null
DEBUG StatusLogger Shutdown hook enabled. Registering a new one.
DEBUG StatusLogger LoggerContext[name=Default, org.apache.logging.log4j.core.LoggerContext#78e22d35] started OK.
It looks like my file is picked with pattern: [%p] %d [%t] %c %M - %m%n
My Log4j2 Config:
# properties file metadata
status=error
dest=err
name=PropertiesConfig
# console appender will log to stdout
appender.consoleAppender.type=Console
appender.consoleAppender.name=STDOUT
appender.consoleAppender.target=SYSTEM_OUT
appender.consoleAppender.layout.type=PatternLayout
appender.consoleAppender.layout.pattern=[%p] %d [%t] %c %M - %m%n
# log level information
rootLogger.level=info
rootLogger.appenderRef.consoleAppender.ref=STDOUT
But all my logs are coming as:
22:10:55,360 INFO org.eclipse.jetty.server.Server - Started #2187ms

I saw your log4j config, and then I observed that your log4j config file may be the incorrect way.
log4j. must be included for each key, according to the documentation.
your log4j Config:
# properties file metadata
status=error
dest=err
name=PropertiesConfig
# console appender will log to stdout
appender.consoleAppender.type=Console
appender.consoleAppender.name=STDOUT
appender.consoleAppender.target=SYSTEM_OUT
appender.consoleAppender.layout.type=PatternLayout
appender.consoleAppender.layout.pattern=[%p] %d [%t] %c %M - %m%n
# log level information
rootLogger.level=info
rootLogger.appenderRef.consoleAppender.ref=STDOUT
Updated log4j.properties Config:
# properties file metadata
status=error
dest=err
name=PropertiesConfig
# console appender will log to stdout
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.target=System.out
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=[%p] %d [%t] %c %M - %m%n
# log level information
log4j.rootLogger=info,console
Note: If you are using SYSTEM_OUT in target then the warning message came on the console.
log4j:WARN [SYSTEM_OUT] should be System.out or System.err.
log4j:WARN Using previously set target, System.out by default.
in my case Pom.xml:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.5</version>
</dependency>
Thanks.

Related

How to add default logback.xml to spring boot project?

I have created a new spring boot project using spring initializer with spring-boot-starter-web as a starter project.I am able to use logback for logging but am unable to find default logback.xml in the project.I tried to search out but could not find reference to default file on logback documentation as well. I am looking to customize the logback file to use custom appender.
You can customize by using your application.yml, like this :
logging:
level:
root: WARN
org.springframework.security: DEBUG
org.springframework.web.servlet: INFO
org.springframework.jmx: INFO
org.springframework.cloud.config.client: INFO
org.springframework.cloud.context: INFO
org.hibernate: INFO
org.hibernate.sql: DEBUG
pattern:
console: '%date{HH:mm:ss.SSS} [%-5level] %-65logger - %msg%n'
file: '%date{HH:mm:ss.SSS} [%-5level] %-65logger - %msg%n'
file: D:/logs/my-log.log
And define for each profile

How to configure Json formatted log with logback in JBOSS EAP 7.1 for spring boot app?

I am trying to deploy a spring boot web app to Jboss EAP 7.1 server. When app runs in Tomcat (spring boot embedded tomcat server), by default it produces Json formatted logs as I have configured logback with slf4j.
But when I try to deploy the same in JBOSS, jboss is not writing any Json format logging. I checked in the web and found that logback is not supported out of the box in JBOSS EAP 7.1.
So I found an article to configure it in JBOSS. [https://blog.anotheria.net/devops/enable-logback-in-jboss/
Now I see that the default log manager is logback but output is still same as normal text?
Expected O/P:
{"timeStamp":"2020-04-27T21:38:28.411+05:30","message":"This is a warn message","logger":"com.example.demo.WelcomeController","thread":"http-nio-8080-exec-3","level":"WARN"}
{"timeStamp":"2020-04-27T21:38:28.415+05:30","message":"This is an error message","logger":"com.example.demo.WelcomeController","thread":"http-nio-8080-exec-3","level":"ERROR"}
Current O/P:
2020-04-27 21:12:17,787 INFO [stdout] (default task-1) 21:12:17.787 [default task-1] DEBUG com.example.demo.WelcomeController - This is a debug message
2020-04-27 21:12:17,788 INFO [stdout] (default task-1) 21:12:17.788 [default task-1] INFO com.example.demo.WelcomeController - This is an info message
2020-04-27 21:12:17,790 INFO [stdout] (default task-1) 21:12:17.790 [default task-1] WARN com.example.demo.WelcomeController - This is a warn message
2020-04-27 21:12:17,793 INFO [stdout] (default task-1) 21:12:17.791 [default task-1] ERROR com.example.demo.WelcomeController - This is an error message
Only changes between the article mentioned above and my configuration is the logback version -
<module xmlns="urn:jboss:module:1.5" name="ch.qos.logback">
<resources>
<resource-root path="logback-classic-1.2.3.jar"/>
<resource-root path="logback-core-1.2.3.jar"/>
</resources>
<dependencies>
<module name="org.slf4j" />
<module name="javax.api" />
<module name="javax.mail.api" />
</dependencies>
</module>
So is there any additional change I have to do? How can I achieve the desired output.
Did not get any response in Jboss tag, so adding spring-boot tag, if anyone can help.

Spring Boot 1.4 not loading application.properties after upgrade

I am in process of upgrading a spring boot 1.3.3 project to 1.4.2.
After upgrading the project Spring boot will no longer use any application.properties file. It does not locate it. Even when passed as an startup argument.
The project is built with gradle and a shadowjar plugin to compile to a fat jar and start tomcat embedded from the jar.
The way the application is started is: java -jar app-all.jar. The directory containing the jar also contains the application.properties file. (and no other files)
There is no classpath set and the jar file does not contain any other application.properties files. (Tested with unzip -t app-all.jar |grep application.properties)
Starting the project under Spring Boot 1.3.3. The application starts correctly. Start of log file:
04:15:58.846 com.app.MaxApplication INFO [main] - Starting MaxApplication on test-ng with PID 30096 (/home/ubuntu/app-all.jar started by ubuntu in /home/ubuntu)
04:15:58.850 com.app.MaxApplication DEBUG [main] - Running with Spring Boot, Spring
04:15:58.850 com.app.MaxApplication INFO [main] - The following profiles are active: TEST
04:15:58.850 org.springframework.boot.SpringApplication DEBUG [main] - Loading source class com.app.MaxApplication
04:15:58.947 org.springframework.boot.context.config.ConfigFileApplicationListener DEBUG [main] - Activated profiles TEST
04:15:58.947 org.springframework.boot.context.config.ConfigFileApplicationListener DEBUG [main] - Loaded config file 'file:./application.properties'
Changing spring boot version to 1.4.2, cleaning gradle caches and rebuilding and running the application the same way Spring Boot does nto load the applciation.properties file and the application fails to start due to missing configuration settings provided by the file. Start of log file:
01:48:47.547 [main] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding [servletConfigInitParams] PropertySource with lowest search precedence
01:48:47.549 [main] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding [servletContextInitParams] PropertySource with lowest search precedence
01:48:47.551 [main] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding [systemProperties] PropertySource with lowest search precedence
01:48:47.552 [main] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding [systemEnvironment] PropertySource with lowest search precedence
01:48:47.552 [main] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Initialized StandardServletEnvironment with PropertySources [servletConfigInitParams,servletContextInitParams,systemProperties,systemEnvironment]
01:48:47.552 [main] DEBUG org.springframework.core.env.PropertySourcesPropertyResolver - Could not find key 'spring.profiles.active' in any property source
01:48:47.552 [main] DEBUG org.springframework.core.env.PropertySourcesPropertyResolver - Could not find key 'spring.profiles.active' in any property source
01:48:47.554 [main] DEBUG org.springframework.core.env.PropertySourcesPropertyResolver - Could not find key 'banner.image.location' in any property source
01:48:47.555 [main] DEBUG org.springframework.core.env.PropertySourcesPropertyResolver - Could not find key 'banner.location' in any property source
01:48:47.556 [main] DEBUG org.springframework.core.env.PropertySourcesPropertyResolver - Could not find key 'banner.charset' in any property source
01:48:47.557 [main] DEBUG org.springframework.core.env.MutablePropertySources - Adding [version] PropertySource with lowest search precedence
01:48:47.560 [main] DEBUG org.springframework.core.env.MutablePropertySources - Adding [ansi] PropertySource with highest search precedence
01:48:47.561 [main] DEBUG org.springframework.core.env.MutablePropertySources - Adding [title] PropertySource with highest search precedence
01:48:47.600 [main] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding [servletConfigInitParams] PropertySource with lowest search precedence
01:48:47.600 [main] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding [servletContextInitParams] PropertySource with lowest search precedence
01:48:47.600 [main] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding [systemProperties] PropertySource with lowest search precedence
01:48:47.600 [main] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding [systemEnvironment] PropertySource with lowest search precedence
01:48:47.601 [main] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Initialized StandardServletEnvironment with PropertySources [servletConfigInitParams,servletContextInitParams,systemProperties,systemEnvironment]
01:48:47.637 [main] DEBUG org.springframework.context.annotation.ClassPathBeanDefinitionScanner - JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning
01:48:47.649 [main] INFO com.app.MaxApplication - Starting MaxApplication on test-ng (/home/ubuntu/app-all.jar started by ubuntu in /home/ubuntu)
01:48:47.649 [main] DEBUG com.app.max.MaxApplication - Running with Spring Boot, Spring
01:48:47.650 [main] DEBUG org.springframework.core.env.PropertySourcesPropertyResolver - Could not find key 'spring.profiles.active' in any property source
01:48:47.650 [main] DEBUG org.springframework.core.env.PropertySourcesPropertyResolver - Could not find key 'spring.profiles.default' in any property source
01:48:47.650 [main] INFO com.app.max.MaxApplication - No active profile set, falling back to default profiles: default
01:48:47.650 [main] DEBUG org.springframework.boot.SpringApplication - Loading source class com.app.MaxApplication
Only two files in the current directory are the application.properties file and the jar file. The externalizing configration documentation says the configuration should be read from there. It also works under Spring 1.3.3
I have defined a configuration class (this is working in 1.3)
#Component
#Configuration
#SpringBootConfiguration
public class MaxApplicationProperties {
#Bean
public static PropertySourcesPlaceholderConfigurer propertyPlaceholderConfigurer() {
return new PropertySourcesPlaceholderConfigurer();
}
}
I have tried:
Adding application.properties file to the class path.
Starting the application with --spring.config.location=application.properties (and with full path as well)
Setting config location environment variables.
Adding annotation #PropertySource("classpath:application.properties") to the MaxApplicationProperties class
Force deleting all downloaded libraries and having gradle re-download everything.
None of these options work to make Spring boot attempt to use the application.properties file the same was as Spring boot 1.3.
Anyone know what I am missing? Thanks.

SpringBoot app starts multiple times and disconnects from logstash

I have an springboot application (Spring Boot v1.3.5.RELEASE) that is run on docker with ./mvnw;
it "restarts" after 1-2 minutes and after second start they don't send any log to logstash..
in first start we see below log
2016-07-27 08:54:29,616 DEBUG [background-preinit] logging: Logging Provider: org.jboss.logging.Slf4jLoggerProvider found via system property
bug after the second one logging provider log is missing..
**2016-07-27 08:54:25,386 INFO [restartedMain] DemoApp: Starting DemoApp on 7adf92b8bc96 with PID 85 (/home/infoowl/project/target/classes started by infoowl in /home/infoowl/project)**
2016-07-27 08:54:25,471 DEBUG [restartedMain] DemoApp: Running with Spring Boot v1.3.5.RELEASE, Spring v4.2.6.RELEASE
2016-07-27 08:54:25,487 INFO [restartedMain] DemoApp: The following profiles are active: dev
2016-07-27 08:54:29,616 DEBUG [background-preinit] logging: Logging Provider: org.jboss.logging.Slf4jLoggerProvider found via system property
2016-07-27 08:54:32,436 INFO [restartedMain] DemoApp: Started DemoApp in 9.865 seconds (JVM running for 14.572)
2016-07-27 08:54:45,937 DEBUG [restartedMain] HttpURLConnection: sun.net.www.MessageHeader#3959b7066 pairs: {GET /config/transformation/dev/master HTTP/1.1: null}{Accept: application/json, application/*+json}{Authorization: Basic YWRtaW46YWRtaW4=}{User-Agent: Java/1.8.0_91}{Host: registry:8761}{Connection: keep-alive}
2016-07-27 08:54:46,512 DEBUG [restartedMain] HttpURLConnection: sun.net.www.MessageHeader#12bba63311 pairs: {null: HTTP/1.1 200 OK}{Server: Apache-Coyote/1.1}{X-Content-Type-Options: nosniff}{X-XSS-Protection: 1; mode=block}{Cache-Control: no-cache, no-store, max-age=0, must-revalidate}{Pragma: no-cache}{Expires: 0}{X-Application-Context: jhipster-registry:dev,native:8761}{Content-Type: application/json;charset=UTF-8}{Transfer-Encoding: chunked}{Date: Wed, 27 Jul 2016 08:54:46 GMT}
2016-07-27 08:54:46,777 INFO [restartedMain] DemoApp: The following profiles are active: dev
2016-07-27 08:55:01,347 WARN [restartedMain] ConfigurationClassPostProcessor: Cannot enhance #Configuration bean definition 'refreshScope' since its singleton instance has been created too early. The typical cause is a non-static #Bean method with a BeanDefinitionRegistryPostProcessor return type: Consider declaring such methods as 'static'.
2016-07-27 08:55:03,767 DEBUG [restartedMain] AsyncConfiguration: Creating Async Task Executor
2016-07-27 08:55:07,072 DEBUG [restartedMain] MetricsConfiguration: Registering JVM gauges
2016-07-27 08:55:07,169 DEBUG [restartedMain] MetricsConfiguration: Initializing Metrics JMX reporting
2016-07-27 08:55:07,281 INFO [restartedMain] MetricsConfiguration: Initializing Metrics Log reporting
2016-07-27 08:55:16,352 INFO [localhost-startStop-1] WebConfigurer: Web application configuration, using profiles: [dev]
2016-07-27 08:55:16,359 DEBUG [localhost-startStop-1] WebConfigurer: Initializing Metrics registries
2016-07-27 08:55:16,383 DEBUG [localhost-startStop-1] WebConfigurer: Registering Metrics Filter
2016-07-27 08:55:16,400 DEBUG [localhost-startStop-1] WebConfigurer: Registering Metrics Servlet
2016-07-27 08:55:16,402 INFO [localhost-startStop-1] WebConfigurer: Web application fully configured
2016-07-27 08:55:19,343 INFO [localhost-startStop-1] CoreApp: Running with Spring profile(s) : [dev]
2016-07-27 08:55:24,670 INFO [restartedMain] LoggingConfiguration: Initializing Logstash logging
2016-07-27 08:55:24,781 INFO [restartedMain] LoggingConfiguration: Logstash customFields: '{"app_name":"transformation","app_port":"9093","instance_id":"transformation:4afb19b3a2763ed887b8d69d246082e6"}', config: 'net.infoowl.hepsiburada.core.config.JHipsterProperties$Logging$Logstash#96d9ebe[enabled=true,host=elk-logstash,port=5000,queueSize=512]'
2016-07-27 08:55:35,367 DEBUG [restartedMain] CacheConfiguration: No cache
2016-07-27 08:55:40,071 DEBUG [restartedMain] DatabaseConfiguration: Configuring Mongeez
2016-07-27 08:55:40,245 INFO [restartedMain] FilesetXMLReader: Parsing XML Fileset file master.xml
2016-07-27 08:55:40,275 INFO [restartedMain] FilesetXMLReader: Num of changefiles found 0
2016-07-27 08:55:41,089 DEBUG [restartedMain] SwaggerConfiguration: Starting Swagger
2016-07-27 08:55:41,218 DEBUG [restartedMain] SwaggerConfiguration: Started Swagger in 118 ms
2016-07-27 08:55:55,610 WARN [restartedMain] URLConfigurationSource: No URLs will be polled as dynamic configuration sources.
2016-07-27 08:55:56,975 WARN [restartedMain] URLConfigurationSource: No URLs will be polled as dynamic configuration sources.
2016-07-27 08:56:00,036 DEBUG [cron4j::scheduler[20b6349f63f32eea2d00877b000001562b91269c7714a479]::launcher[20b6349f63f32eea238ca33a000001562b9155042b804084]] CronPlugin: Found crontab config url org.crsh.vfs.Resource#7a65b25c
**2016-07-27 08:56:00,788 INFO [restartedMain] DemoApp: Starting DemoApp on 7adf92b8bc96 with PID 85 (/home/infoowl/project/target/classes started by infoowl in /home/infoowl/project)**
2016-07-27 08:56:00,788 DEBUG [restartedMain] DemoApp: Running with Spring Boot v1.3.5.RELEASE, Spring v4.2.6.RELEASE
2016-07-27 08:56:00,788 INFO [restartedMain] DemoApp: The following profiles are active: dev
2016-07-27 08:56:01,290 INFO [restartedMain] DemoApp: Started DemoApp in 0.899 seconds (JVM running for 103.426)
another observation.. see second start is just "0.899 seconds" which is not possible.. Actually it seems second one is not a real start but logstash connection is gone..
What may be the reason for this second start? Where should I check and investigate;
From documentation:
Applications that use spring-boot-devtools will automatically restart
whenever files on the classpath change.
You can exclude resources or disable restarts.
I found the problem, the details are here;
https://github.com/spring-cloud/spring-cloud-stream/issues/605

Spring-Camel (camel logs by default goes console 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 Integration is XMl element :
<camelContext xmlns="http://camel.apache.org/schema/spring">
<routeBuilder ref="smtBatchRouter" />
</camelContext>
My Log4J configuration:
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
Sample Camel Log that I am getting in console :
[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
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.
So I just deleted redundant slf4j-jdk14-1.7.9.jar and left only slf4j-log4j12-1.7.19.jar.

Resources