How to configure log4j with a properties file

Posted by Dan on Stack Overflow See other posts from Stack Overflow or by Dan
Published on 2010-02-18T13:29:58Z Indexed on 2011/02/10 7:25 UTC
Read the original article Hit count: 297

Filed under:
|
|

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:

   PropertyConfigurator.configure("log4j.properties");

The log4j.properties file sits in the same directory when I open the Jar.

Yet I get this error:

log4j:ERROR Could not read configuration file [log4j.properties]. java.io.FileNotFoundException: log4j.properties (The system cannot find the file specified)

What am I doing wrong?

© Stack Overflow or respective owner

Related posts about java

Related posts about properties