Hi everyone! I'm having a problem using external configuration files. I'm pretty new to log4j. I can create and use loggers with the BasicConfigurator, but when I try to use my own properties file, it doesn't work. Here's what's going on:
It's very simple, I'm using a .properties file rather than XML. I saved it as "log4j.properties" # Log4j configuration file. log4j.rootCategory=DEBUG, A1 # A1 is a ConsoleAppender # log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=%-5p [%t] - %m%n # #set level # log4j.logger.com=ERROR I'm using NetBeans IDE 3.5.1 and I put the "log4j.properties" file in the same directory as my java class that has main (the 'demo' package - see below). public static void main(String args[]) { PropertyConfigurator.configure("log4j.properties"); logger = Logger.getLogger(com.corp.ors.demo.OrsDemo.class); logger.info("OrsDemoLogger working"); I keep getting this error, and I don't know what to do: log4j:ERROR Could not read configuration file [log4j.properties]. java.io.FileNotFoundException: log4j.properties (The system cannot find the file specified) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(FileInputStream.java:106) at java.io.FileInputStream.<init>(FileInputStream.java:66) at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java: 297) at org.apache.log4j.PropertyConfigurator.configure(PropertyConfigurator.java:31 5) at com.corp.ors.demo.OrsDemo.main(OrisDemo.java:228) log4j:ERROR Ignoring configuration file [log4j.properties]. log4j:WARN No appenders could be found for logger (com.corp.ors.demo.OrsDemo). log4j:WARN Please initialize the log4j system properly. Is my configuration file wrong? Does it need to be in a different place? Any help or references would be appreciated. Thanks! Kathryn [EMAIL PROTECTED]