Slf4j,commons-logging,log4j and so on the relationship of log jar

Source: Internet
Author: User

Through the above diagram, you can simply clarify the relationship!

Commons-logging and SLF4J are log interfaces for use by users, without providing implementations!

Log4j,logback and so on is the real implementation of the log.

When we invoke an interface, the factory of the interface automatically finds the appropriate implementation, returning an instance of the implementation to the service. These processes are transparent and users do not need to do anything!

Here's a little story, when Apache persuaded Log4j and other logs to be written according to commons-logging standards, but because of commons-logging class loading a bit of a problem, the implementation is not friendly, so log4j author created slf4j , and thus with the commons-logging two points of the world. As for which to use, it is up to the user to decide.

In this way, SLF4J appears, it can find the implementation of its own interface by simple implementation class, if not meet their own standards of the log, can be achieved through some intermediate implementations such as the above Slf4j-log4j12.jar to adapt.

Article excerpt from http://www.cnblogs.com/xing901022/p/4149524.html

Slf4j,commons-logging,log4j and so on the relationship of log jar

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.