配置文件打jar内部 访问方法

log4j中配置文件log4j.properties
如果要把java文件打包成jar文件,程序中访问log4j.properties方法:
InputStream in = ClassLoader.getSystemClassLoader().getResourceAsStream("log4j.properties");

PropertyConfigurator.configure(in);

此时log4j.properties在src下。

猜你喜欢

转载自blog.csdn.net/prh1023/article/details/80705663
今日推荐