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();

Leave a Reply

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

Please reload

Please Wait