Path: blob/master/src/java.logging/share/classes/java/util/logging/package-info.java
41159 views
/*1* Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425/**26* Provides the classes and interfaces of27* the Java 2 platform's core logging facilities.28* The central goal of the logging APIs is to support maintaining and servicing29* software at customer sites.30*31* <P>32* There are four main target uses of the logs:33* </P>34*35* <OL>36* <LI> <I>Problem diagnosis by end users and system administrators</I>.37* This consists of simple logging of common problems that can be fixed38* or tracked locally, such as running out of resources, security failures,39* and simple configuration errors.40*41* <LI> <I>Problem diagnosis by field service engineers</I>. The logging information42* used by field service engineers may be considerably more complex and43* verbose than that required by system administrators. Typically such information44* will require extra logging within particular subsystems.45*46* <LI> <I>Problem diagnosis by the development organization</I>.47* When a problem occurs in the field, it may be necessary to return the captured logging48* information to the original development team for diagnosis. This logging49* information may be extremely detailed and fairly inscrutable. Such information might include50* detailed tracing on the internal execution of particular subsystems.51*52* <LI> <I>Problem diagnosis by developers</I>. The Logging APIs may also be53* used to help debug an application under development. This may54* include logging information generated by the target application55* as well as logging information generated by lower-level libraries.56* Note however that while this use is perfectly reasonable,57* the logging APIs are not intended to replace the normal debugging58* and profiling tools that may already exist in the development environment.59* </OL>60*61* <p>62* The key elements of this package include:63* <UL>64* <LI> <I>Logger</I>: The main entity on which applications make65* logging calls. A Logger object is used to log messages66* for a specific system or application67* component.68* <LI> <I>LogRecord</I>: Used to pass logging requests between the logging69* framework and individual log handlers.70* <LI> <I>Handler</I>: Exports LogRecord objects to a variety of destinations71* including memory, output streams, consoles, files, and sockets.72* A variety of Handler subclasses exist for this purpose. Additional Handlers73* may be developed by third parties and delivered on top of the core platform.74* <LI> <I>Level</I>: Defines a set of standard logging levels that can be used75* to control logging output. Programs can be configured to output logging76* for some levels while ignoring output for others.77* <LI> <I>Filter</I>: Provides fine-grained control over what gets logged,78* beyond the control provided by log levels. The logging APIs support a general-purpose79* filter mechanism that allows application code to attach arbitrary filters to80* control logging output.81*82* <LI> <I>Formatter</I>: Provides support for formatting LogRecord objects. This83* package includes two formatters, SimpleFormatter and84* XMLFormatter, for formatting log records in plain text85* or XML respectively. As with Handlers, additional Formatters86* may be developed by third parties.87* </UL>88* <P>89* The Logging APIs offer both static and dynamic configuration control.90* Static control enables field service staff to set up a particular configuration and then re-launch the91* application with the new logging settings. Dynamic control allows for updates to the92* logging configuration within a currently running program. The APIs also allow for logging to be93* enabled or disabled for different functional areas of the system. For example,94* a field service engineer might be interested in tracing all AWT events, but might have no interest in95* socket events or memory management.96* </P>97*98* <h2>Null Pointers</h2>99* <p>100* In general, unless otherwise noted in the javadoc, methods and101* constructors will throw NullPointerException if passed a null argument.102* The one broad exception to this rule is that the logging convenience103* methods in the Logger class (the config, entering, exiting, fine, finer, finest,104* log, logp, logrb, severe, throwing, and warning methods)105* will accept null values106* for all arguments except for the initial Level argument (if any).107*108* <H2>Related Documentation</H2>109* <P>110* For an overview of control flow,111* please refer to the112* {@extLink logging_overview Java Logging Overview}113* </P>114*115* @since 1.4116*/117package java.util.logging;118119120