donderdag 17 april 2008

log4j properties and JUnit

Running my testcases I couldn't get them to find the log4j.properties, resulting in the well known "no appenders found ..." exception. Putting this file on the classpath didn't help. The only way I could get it to work is to manually put the property in the testcase setup, like this:
String path = this.getClass().getResource("./log4j.properties").getPath();
PropertyConfigurator.configure(path);

Geen opmerkingen:

Een reactie posten