一、官网下载commons-logging-1.2.jar包
下载链接:Apache Commons Logging - Download Apache Commons Logging
二、IDEA中导入jar包
1、复制 commons-logging-1.2.jar文件
2、打开IDEA新建一个package
3、把jar包复制到刚创建的包下
4、添加到Library中
出现有下拉选项表示成功
eg:
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class Test {
public static void main(String[] args) {
Log log = LogFactory.getLog(Test.class);
log.info("start...");
log.warn("end.");
}
}
运行结果:
4月 17, 2022 2:10:39 下午 h220416.Test main
信息: start...
4月 17, 2022 2:10:39 下午 h220416.Test main
警告: end.