"JAVA Package Dependency" Log package log4j dependent

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.