zoukankan      html  css  js  c++  java
  • Java Logging: Log Levels

    Table of Contents

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

    • SEVERE
    • WARNING
    • INFO
    • CONFIG
    • FINE
    • FINER
    • FINEST

    The log level is represented by the class java.util.logging.Level. This class contains a constant for each of the above log levels. It is one of these constants you use when you log a message to a Logger. Here is 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 Logger to not log, and not propagate messages below a certain level. Here is an example of that:

    logger.setLevel(Level.WARNING);
    

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

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

  • 相关阅读:
    python之private variable
    python实例、类方法、静态方法
    python常用option
    access
    FD_CLOEXEC
    fork后父子进程文件描述问题
    split
    信号
    kill
    进程组&Session
  • 原文地址:https://www.cnblogs.com/hephec/p/4579624.html
Copyright © 2011-2022 走看看