Recently I was trying to implement logger concept in my java application.
While executing the java program I encountered an Exception:

log4j:WARN No appenders could be found for logger (Log4jTest.Test).
log4j:WARN Please initialize the log4j system properly.

To fix this issue you need to create a "log4j.properties" file and add it to the classpath for your Eclipse project. To add a property file to classpath :

1. create a log4j.properties file like this:
log4j.rootCategory=TRACE, CONSOLE
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.Threshold=INFO
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=- %m%n
2. zip the file and rename it .jar (log4jprops.zip => log4jprops.jar), put the file in a folder you like (example: /workspace/log4jprops/log4jprops.jar)
3. in Eclipse: Run, Debug, click the configuration you want, select Classpath tab
4. click on the User Entries item in the tree view to select it
5. click advanced, select "Add Classpath Variables" radio, and click OK
6. select or create a variable named LOG4J_PROPS, and point it to the JAR created before.

One thought on “log4j:WARN Please initialize the log4j system properly”

Leave a Reply to Jirka Pinkas Cancel reply

Your email address will not be published. Required fields are marked *