Logger object is used
to emit log messages.
Logger does not have a
public constructor, but there are several ways to obtain a
Logger object to use in your code:
Typically, applications call the static
getLogger( )method to create or lookup a named
Loggerwithin a hierarchy of named loggers. Loggers have dot-separated hierarchical names, which should be based on the name of the class or package that uses them. Loggers obtained in this way inherit their logging level, resource bundle (for localization), and
Handlerobjects from their ancestors in the hierarchy and, ultimately, from the root
Loggerdefined by the global
Applets that require a
Loggerwith no security restrictions should use the static
getAnonymousLogger( )method to create an unnamed
Loggerthat is not part of the hierarchy of named
Loggerobjects managed by the
Loggercreated by this method has the
LogManagerroot logger as its parent, and inherits the logging level and handlers of that root logger.
Finally, the static
Logger.globalfield refers to a pre-defined
Loggernamed “global”; programmers may find this pre-defined
Loggerconvenient during the early stages of application development, but it should not be used in production code.
Once a suitable
Logger has been obtained, there
are a variety of methods that can be used to create a log message:
log( )methods log a specified message at the specified level, with optional parameters that can be used in message localization. ...