我使用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].log4j:WARN No appenders could be found for logger (com.corp.ors.demo.OrsDemo).log4j:WARN Please initialize the log4j system properly.可以从http://www.91files.com/?N3F0QGQPWMDGPBRN0QA8获取示例项目
添加回答
举报
0/150
提交
取消