This article resolves the minimum and log-related packages required to build a LOG4J Log framework project:
Commons-logging-xxx.jar
Log4j-xxx.jar
Slf4j-api-xxx.jar
Slf4j-log4j12-xxx.jar
Interested comrades can continue to look at the following:
The current open source log framework for Java is mainly divided into 2 tiers:
1) Log façade (can be understood as interface)
2) Log framework specific code (specifically implemented)
Of the above 4 jar packages
Commons-logging-xxx.jar
Slf4j-api-xxx.jar
respectively, it corresponds to JCL and slf4j two kinds of log façade.
The latter is a substitute for the former, which solves some problems of the former.
But, to be aware, I began to think that the two brothers were parallel, not really.
When we use SLF4J, we must also include Commons-logging-xxx.jar in the project. The specific reason is free to verify. The official explanation is: you just leave it.
And then what:
Log4j-xxx.jar is the log4j core log Framework code.
What is that Slf4j-log4j12-xxx.jar for?
Can be understood as a link
Log4j-xxx.jar
Slf4j-api-xxx.jar
Bridge, or an adapter.
My personal understanding is that when log4j just came out should not follow slf4j, so wrote an adapter to socket. "Maybe not, then help yourself to remember":)
"JAVA Package Dependency" Log package log4j dependent