Application of logger class in Java

Source: Internet
Author: User
class Logger
Java.lang.Object

Java.util.logging.Logger

The Logger object is used to record log messages for a particular system or application component. You typically use a dot-delimited hierarchical namespace to name Logger. Logger names can be arbitrary strings, but they should generally be based on the package name or class name of the component being recorded, such as java.net or javax.swing. In addition, you can create an "anonymous" Logger whose name is not stored in the Logger namespace. 1, the Logger object can be obtained by invoking the factory method GetLogger or Getanonymouslogger.

Gets a Logger object named "a" Logger loggera= Logger.getlogger ("a"); Gets a Logger object named "A.b" whose parent logger is loggera.

Logger loggerab= Logger.getlogger ("a.b");

Gets an anonymous Logger object Logger loggertmp = Logger.getanonymouslogger (); For non-anonymous Logger,getlogger first find the Logger object of the same name in the namespace, and if so, return the Logger object, or, if not, create a new logger object in the namespace and associate it with its parent logger object. An anonymous logger object belongs to the private object of the object that created it, and can only be used by the object that created it, and some temporary log information is logged. The named Logger object is global and can be used by other objects to log information in addition to the object that created it during the lifetime of the log frame

2. The following message levels are defined in the j2sdk1.4 Java Logging framework: level name int value (Windows 2000 environment) off 2147483647 SEVERE 1000 WARNING 90 0 CONFIG FINE Finer FINEST-ALL-2147483648

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.