Java log framework and Log System

Source: Internet
Author: User

Log framework: Provides an interface for calling logs. The actual log output is delegated to the log system for implementation.

  • JCL (Jakarta Commons Logging): a popular log framework, many of which depend on JCL, such as Spring.
  • SLF4j: provides new APIs. It was originally used with Logback but is also compatible with Log4j.

Log System: Outputs logs.

  • Log4j: an earlier log system that can be used independently or with the log framework JCL.
  • Logback: an alternative to Log4j, which must be used with the log framework SLF4j
  • JUL (java. util. logging): the log system provided by JDK is chaotic and not commonly used.

Log System usage

Log framework Log System Description
-- Log4j Log4j can be used independently, not recommended
JCL Log4j Use log4j with JCL
SLF4j Logback Use logback with SLF4j
SLF4j SLF4j-Log4j12 + log4j Log4j works with SLF4j, but uses SLF4j-Log4j12 for bridging
Server Load balancer + JCL-over-SLF4j Logback Enable the system using JCL + log4j to use logback to output logs.
Server Load balancer + JCL-over-SLF4j SLF4j-log4j12 + Log4j The framework uses SLF4j, but logs use Log4j and are compatible with the original JCL interface. This method is mostly due to complex package dependencies, and each package uses different log frameworks.
SLF4j + JCL-over-SLF4j + log4j-over-slf4j SLF4j-log4j12 + log4j In addition, it is compatible with scenarios where some packages use log4j directly.

Description

  • JCL-over-SLF4j is a compatible framework that is compatible with the JCL interface and uses the SLF4j log framework, dependent on SLF4j, but cannot coexist with JCL
  • SLF4j-Log4j12 is a compatible framework to make Log4j work in the SLF4j environment. It is the same as logback as a log system and cannot coexist.
  • Log4j-over-slf4j is used to use the SLF4j framework and is compatible with the use of log4j directly

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.