Sunday, May 31, 2015

Log4j configuration for JUnit log-statements to be displayed in Eclipse Console.

Problem Statement: In Eclipse Console while running the JUnit you are getting following error:

log4j:WARN Please initialize the log4j system properly

Diagnosis: Log4J needs to be configured for this logging to work properly. Most likely the log4j.properties (or log4j.xml) file isn't in the root of your test classpath.

Solution:
1. Open "Run Configurations" dialog (click the "Run" menu and go to "Run Configurations")
2. Go to the "Classpath" tab
3. Select the "User Entries" and click the "Advanced" button on the right side.
4. Now select the "Add folder" radio button.
5. Select the "test/resources" folder


No comments: