How do I get log4j to pick up a properties file.
I\'m writing a Java desktop app which I want to use log4j. In my main method if have this:
Proper
import org.apache.log4j.PropertyConfigurator;
Import this, then:
Properties props = new Properties();
InputStream is = Main.class.getResourceAsStream("/log4j.properties");
try {
props.load(is);
} catch (Exception e) {
// ignore this exception
log.error("Unable to load log4j properties file.",e);
}
PropertyConfigurator.configure(props);
My java files directory like this:
src/main/java/com/abc/xyz
And log4j directory like this:
src/main/resources