Java Logging:log Levels

Source: Internet
Author: User

Table of Contents
    • Filtering Messages

When a-message is logged via a Logger it's logged with a certain log level. The built-in log levels is:

    • SEVERE
    • WARNING
    • INFO
    • CONFIG
    • FINE
    • Finer
    • FINEST

The log level was represented by the class java.util.logging.Level . This class contains a constant for each of the above log levels. It is one of the these constants you use when you log a message to a Logger . Here are an example:

Logger.log (level.severe, "A SEVERE message!");
Filtering Messages

You can filter the messages by their log level, meaning you can configure a to not Logger log, and not propagate messages B Elow a certain level. Here is a example of that:

Logger.setlevel (level.warning);

The now Logger ignores all messages below the log level WARNING .

To understand how log levels behave Logger in the hierarchy, check out the text on the Logger hierarchy.

Java Logging:log Levels

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.