Java built-in logging framework

Source: Internet
Author: User

Java Logging

Java has a log system (logging framework) that records the runtime information of a program on the JVM ).

The program can use logger (Java. util. Logging. Logger) to record logs.

Java uses a hierarchical naming method (for example, java. AWT) to manage logger. Using logmanager, sub-logger may inherit some attributes from their parent logger ..

Use logger. getlogger (name) to obtain the desired logger. Therefore, the generated logger is usually bound with eaglehandle by default. logs recorded by logger are directly displayed on the command console.

Logger can bind multiple handler to record logs in different ways. Both logger and handler have a Level Attribute. Logs lower than this level are not recorded.

Logrecord has seven levels:
· Severe (highest value)
· Warning
· Info
· Config
· Fine
· Finer
· Finest (lowest value)

Logger uses the void log (Level level, string MSG) method to record logs. You can also use a specific method to record logs at a specific level, such
Void Info (string MSG) records the level. info level logrecord.

You can use filter and formatter to filter or format logs and assemble relationships.

 

 

References:
1) http://java.sun.com/j2se/1.4.2/docs/guide/util/logging/overview.html
2) http://www.webasp.net/article/22/21433_print.htm is 1) the Chinese version, where examples can be more clear.

 

 

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.