关于配置文件问题,请高人帮忙。谢谢!
我想配置log4j的属性文件,可是编译出错:Error:Could not found the log configuration!!!可是我建了此文件了,不知道为什么?代码如下,还请高人帮忙,谢谢!
protected void setLog4JConfig() {
File logConfig = new File(System.getProperty("a.home"), "/conf/log.properties");
if (logConfig.exists()) {
try {
Properties props = new Properties();
props.load(new FileInputStream(logConfig.getAbsolutePath()));
Properties logProps = new Properties();
Enumeration names = props.propertyNames();
while (names.hasMoreElements()) {
String name = (String)names.nextElement();
String value = props.getProperty(name);
String newValue = macroProcessing(props, value);
logProps.setProperty(name, newValue);
}
PropertyConfigurator.configure(logProps);
} catch (IOException ex) {
System.err.println("Error:Processing log configuration!!!");
System.exit(1);
}
} else {
System.err.println("Error:Could not found the log configuration!!!");
System.exit(1);
}
}