您的位置:首页 > 其它

程序自定义加载log4j配置文件

2014-07-04 23:33 351 查看
/**
* 装载Log4j 配置文件
*
*/
public static final void loadLog4jConfig(){
Properties prop = new Properties();
try {
FileInputStream stream=new FileInputStream("/var/conf/bin/log4j.properties");
prop.load(stream);
stream.close();//这样log4j对配置文件可以放置在任何位置
PropertyConfigurator.configure(prop);//装入log4j配置信息
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: