Java log Development

Source: Internet
Author: User
  • 1. 1. Log System)

    Log4j --Log4j is the log system that appears successfully earlier. The log system model (logger/appender/level) created by log4j is effective and has been used for a long time.

    Jul(Java. util. Logging .*)-- Jdk1.4 is the first JDK with its own log system (Jul ). Jul does not have any obvious advantages to defeat log4j. Instead, it creates standard chaos-applications using different log systems cannot coexist harmoniously.

    Logback-- Is a newer log system. It is a new system developed by log4j authors after years of experience. It is more convenient to use, has stronger functions, and has higher performance. Logback cannot be used independently. It must be used with the log framework slf4j.

    1. 2. Log framework)

    After Jul was born, a "log framework" emerged to overcome the confusions brought about by the coexistence of multiple log systems ". The log framework itself does not provide the logging function. It only provides the APIS called by logs. The log Framework relies on actual log systems such as log4j or Jul to generate real logs.

    The advantage of using the log framework is that the application deployer can decide which log system (log4j or Jul) to use or switch between multiple log systems, you do not need to change the application code.

    Jcl(Jakarta commons Logging)-- This is currently the most popular log framework, provided by the Apache Jakarta community. Both the Spring framework and webx2 framework depend on jcl.

    Slf4j-- This is the latest log framework launched by the author of log4j. Slf4j provides new APIs, especially used with the new functions of logback. Slf4j is also compatible with log4j. This framework is used to replace the jcl framework.

    1.3.SLF4J
    Slf4j (simple logging facade for Java) is a general log framework. It cannot be called a facade. The role played is equivalent to Jakarta commons logging.
    Two application modes of slf4j: slf4j + log4j and slf4j + logback
    Specific use, refer to: http://cammsia.javaeye.com/blog/645080
  • 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.