欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

log4j 和slf4j的 类冲突解决

程序员文章站 2022-03-10 14:33:31
...

1. 检查 log4j 和slf4j的冲突

 

public class Log4jTest {

	public static void main(String[] args) {
		try {
			Class.forName("org.slf4j.impl.Log4jLoggerFactory");
		} catch (ClassNotFoundException e) {
			System.out.println(e.getMessage());
		}

		try {
			Class.forName("org.apache.log4j.Log4jLoggerFactory");
		} catch (ClassNotFoundException e) {
			System.out.println(e.getMessage());
		}
	}
}