加载log4j的配置文件

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Joyce_heart/article/details/80854354

1.当配置文件放在测试文件的同一级目录下,是不需要读取配置文件的
2.当配置文件放在其他文件夹下,是需要读取配置文件的

1)log4j.xml文件的读取
DOMConfigurator.configure("conf/log4j.xml");
2)log4j.properties文件的读取
PropertyConfigurator.configure("conf/log4j.properties");

猜你喜欢

转载自blog.csdn.net/Joyce_heart/article/details/80854354