关于配置文件问题,请高人帮忙。谢谢!

blackrain06 2004-04-12 09:28:26
我想配置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);
}
}
...全文
72 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
wilddonkey 2004-04-12
  • 打赏
  • 举报
回复
up
blackrain06 2004-04-12
  • 打赏
  • 举报
回复
up
blackrain06 2004-04-12
  • 打赏
  • 举报
回复
win,可是我查了一下,路径没什么问题
kevinliuu 2004-04-12
  • 打赏
  • 举报
回复
是文件路径有问题吧,win还是linux?

62,622

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧