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

来源:互联网 发布:c 小程序源码下载 编辑:程序博客网 时间:2024/05/17 05:08


/** * 装载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();}}


0 0