InputStream log4j = Yourclass.class.getClass().getResourceAsStream("/log4j.properties");
PropertyConfigurator.configure(log4j);
本文介绍了一种在Java应用程序中使用Log4j进行日志记录的方法。通过获取类路径下的log4j.properties配置文件并使用PropertyConfigurator进行配置。
InputStream log4j = Yourclass.class.getClass().getResourceAsStream("/log4j.properties");
PropertyConfigurator.configure(log4j);
511
780
568

被折叠的 条评论
为什么被折叠?