Java Reference
In-Depth Information
StreamHandler. Sends the formatted log record to any OutputStream.
MemoryHandler. Writes the formatted log record to memory.
SocketHandler. Sends the formatted log record to a socket.
The process of logging starts with the Logger class, which contains the
methods that an application uses to log a LogRecord. Messages are logged for
different reasons and at different levels, as the following methods in the Log-
ger class illustrate:
public static Logger getLogger(String name). A static method an appli-
cation uses to obtain a Logger object. The name parameter represents the
name of the Logger object to obtain. If a Logger with the given name
already exists, the method returns this Logger; otherwise, this method
creates a new Logger with the given name. This allows Logger objects to
be shared among threads and applications.
public void addHandler(Handler h). Adds the given Handler to the
Logger so that the Handler will now receive any logged messages.
public void log(Level level, String message). Logs the given message at
the specified level. The possible values of level are static fields in the
Level class and include, in descending order of severity, SEVERE,
WARNING, INFO, CONFIG, FINE, FINER, and FINEST. This method is
identical to invoking one of the following methods.
public void fine(String message). Logs a FINE message, which indicates
the level of tracing information to provide. A FINE message contains the
least amount of tracing information.
public void finer(String message). Logs a FINER message, which con-
tains a fairly detailed tracing message.
public void finest(String message). Logs a FINEST message, which con-
tains a highly detailed tracing message.
public void config(String message). Logs a CONFIG message for static
configuration messages, such as the current Swing look and feel or
monitor resolution.
public void severe(String message). Logs a SEVERE message for indi-
cating a serious problem with the application.
public void warning(String message). Logs a WARNING message for
indicating a warning of a potential problem.
public void info(String message).
Logs an INFO message for general
information messages.
Search WWH ::




Custom Search