First page Back Continue Last page Graphics

Java Logging


Java Logging

The logging API is part of the J2SE in JDK 1.4 and later versions, and the java.util.logging package is shipped with the JDK. It is designed to enable a Java program produce messages of interest to end users, system administrators, and software developers. It is useful in production environments where you can’t run the debugger, or where running the debugger might hide the problem. For example, timing-related problems often can’t be reproduced when running in the debugger.

The primary class in the logging facility is Logger. A Logger represents a sort of channel through which logging messages can be sent. Usually each class has its own Logger.

A Logger is configured with a Level. This is a class that indicates the severity of the problem being reported and/or the level of detail required for that individual class. The predefined levels are as follows:

SEVERE: Extremely important messages such as fatal errors

WARNING: Warning messages

INFO: Informational run-time messages

CONFIG: Informational messages about configuration settings

FINE: Used for greater detail when diagnosing problems

FINER: Even greater detail

FINEST: Greatest detail