1
votes

I have developed a Java Camel project that moves files from resources/data/inbox to a SFTP server.

When I run it I get this message:

/usr/lib/jvm/jdk1.8.0_144/bin/java... log4j:WARN No appenders could be found for logger (org.apache.camel.impl.DefaultCamelContext). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. Process finished with exit code 0

I dont really understand what that warning message means. Can anyone explain how I can deal with it?

1
Do you have a log4j.xml file in your classpath?Tommaso Pasini

1 Answers

5
votes

This Short introduction to log4j guide is a little bit old but still valid.

That guide will give you some information about how to use loggers and appenders.


Just to get you going you have two simple approaches you can take.

First one is to just add this line to your main method:

BasicConfigurator.configure();

The second approach is to add this standard log4j.properties (taken from the above-mentioned guide) file to your classpath:

# Set root logger level to DEBUG and its only appender to A1.
log4j.rootLogger=DEBUG, A1

# A1 is set to be a ConsoleAppender.
log4j.appender.A1=org.apache.log4j.ConsoleAppender

# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n