log4j Tutorial 1, overview

Source: Internet
Author: User
Tags log4j

Log4j is a reliable, fast and flexible log framework (API) written in Java, which is published under the Apache software license. LOG4J has been ported to languages such as C,c++,c#,perl,python and Ruby. The log4j is highly configurable and can be configured by external files at run time. It is based on the priority level of records and provides mechanisms to indicate the logging of information to many destinations, such as: databases, files, consoles, UNIX system logs, etc.

There are three main components in the log4j:

    • Loggers: Responsible for capturing record information.

    • Appenders: Responsible for publishing log information to different preferred destinations.

    • Layouts: Responsible for formatting different styles of log information.

The history of Log4j
    • The E.U SEMPER (secure electronics market for Europe), which began in early 1996, tracks API projects.

    • Countless improvements, after a few large jobs, the API has evolved into LOG4J, a popular log-recorder package for Java.

    • The package is an Apache software license that is released under a no-compromise open source license.

    • The latest version of log4j, including full source code, class files and documentation can be found here http://logging.apache.org/log4j/.

LOG4J Features:
    • LOG4J is thread-safe.

    • Log4j is optimized for speed.

    • Log4j is based on a hierarchical structure called a logger

    • LOG4J support for each logger multiple output append (Appender)

    • LOG4J supports internationalization.

    • Log4j is not limited to a set of predefined devices

    • Log behavior can be set at run time using a configuration file

    • log4j Design deals with Java exceptions from the start

    • LOG4J uses multiple levels, namely All,trace,debug,info,warn,error and fatal

    • The format of the log output can be easily changed by extending the layout class

    • The target of the log output, as well as the write policy can be changed by implementing the Appender program interface

    • LOG4J will fail to stop. However, although it certainly strives to ensure delivery, LOG4J does not guarantee that each log statement will be delivered to the destination.

Log records n Disadvantages and advantages:

Logs are an important part of software development. A well-written log code provides fast debugging, easy maintenance, and structured storage of application run-time information.

Logging does have its drawbacks, too. It can slow down the application. If too detailed, it may cause rolling blindness. To mitigate these effects, the log4j is designed to be reliable, fast and scalable.

Since records are rarely the primary focus of the application, the LOG4J API is dedicated to becoming easy to understand and use.

log4j Tutorial 1, overview

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.