Java SDK 1.4 Logging API - Core Objects

  Return to the Java Programming Corner.


The Java 1.4 Logging API consistes of several classes that are responsible for capturing logging information, process and publish the intended logging information to any preferred destination. The following is a list of the core classes that make up the logging API:

LogManager

The java.util.logging.LogManager class is a singleton that is responsible for managing the logger namespace hierarchy. This class reads a system-wide configuration file to set the initial properties for the logging framework. Remember that a singleton is a class that is available only once per Java Virtual Manager (JVM) instance of an application.

Logger

The java.util.logging.Logger class is responsible for carrying out the logging activity. This class provides several logging methods to publish logging information.

LogRecord

The java.util.logging.LogRecord class encapsulates all the logging information. Typically, it contains header information for the message like: the date and timestamp of the logging message, the origin of the logging activity, and the granularity and priority level of the logging message.

Handler

The java.util.logging.Handler class is responsible for publishing logging information to various destinations - a file, console, memory buffers, etc.

Filter

The java.util.logging.Filter class is used by Logger objects to decide whether logging information should be passed to a Handler to deal with it or simply be ignored. Handler objects can also use Filter objects to perform more checks on a logging request before publishing them to the final destination.

Formatter

The java.util.logging.Formatter class is responsible for providing required structure to the logging information being published. Formatters also perform the localization of logging information, if configured to do so.