log4j.properties文件 定位

倘若log4j.properties文件不放在src目录下,估计要指定位置啦。

项目在Listener.init()方法中写到(如下),估计是用来定位的。

		try {
			String resource = "/log4j.properties";
			Properties prop = new Properties();
			prop.load(this.getClass().getResourceAsStream(resource));
			PropertyConfigurator.configure(prop);
		} catch (Exception ex) {
			ex.printStackTrace();
		}
//import java.util.Properties;
//import org.apache.log4j.PropertyConfigurator;

猜你喜欢

转载自zoutuo1986.iteye.com/blog/1433320