我应该将log4j.properties文件放在哪里?
我使用netfishs 6.7.1和glassfish v2.1编写了一个Web服务项目,将log4j.properties放入项目的根目录并使用: static Logger logger = Logger.getLogger(MyClass.class); 在构造函数中: PropertyConfigurator.configure("log4j.properties"); 在功能上: logger.info("..."); logger.error("..."); // ... 但是,这是错误信息(实际上,我已经尝试将它几乎可以实现的每个目录都放入): 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:315) at com.corp.ors.demo.OrsDemo.main(OrisDemo.java:228) log4j:ERROR Ignoring configuration file [log4j.properties]. …