Java Logging:overview

Source: Internet
Author: User

Table of Contents
    • Log level
    • Logger Hierarchy
    • Logmanager

In this text I'll try to give your an overview of the java.util.logging API. Hopefully it is easier to understand, the individual components once your understand the big picture. Many of the concepts described here is also covered in more details in subsequent texts.

Here's an overview diagram of the Java Logging API works:

An overview of the core components in the Java Logging API

All logging are done via a Logger instance. Loggers gather the data to is logged into a LogRecord . LogRecordforwarded to a Handler . The determines what does with the Handler LogRecord . For instance, the LogRecord can is written to disk, or sent through the network to a surveillance system.

Both Logger ' s and Handler ' s can pass the LogRecord through a Filter which determines whether the LogRecord should be forwarded or not .

A Handler can also use a to format the as Formatter LogRecord a string before it's sent to the external disk or system.

Log level

Whenever a message is logged, the this message was logged with a certain log level. The level is a integer which determines how important the message is. The higher the number (level) is and the more important the message is.

A Logger can has a minimum log level set on it, which determines if the message was forwarded to a Handler or not. This isn't a Filter , even though it has the same effect. For instance, any messages below a certain level can suppressed.

Logger Hierarchy

The Logger instances is organized into a hierarchy. A Logger further down in the hierarchy would forward messages logged to it and to its ancestors in the hierarchy. Thus, log levels and messages can be filtered or switched on and off for entire branches of the Logger hierarchy at a time.

Logmanager

The is a component, that's not displayed in the diagram at the top of this LogManager text. LogManager Logger The holds the hierarchy, and also a global logging configuration, which can is read from a file. The is also covered in more detail in its LogManager own text.

Java Logging: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.