Java Reference
In-Depth Information
higher values indicating higher priorities and lower values indicating lower priorities. he levels in
descending order are as follows:
◾
Warning
Severe (highest value)
◾
◾
Conig
Info
◾
◾
Finer
Fine
◾
◾
Finest (lowest value)
In addition there are two more values—all and of—that can be use d for managing the level.
9.4.2.3 The
LogManager
Class
here is a single global
LogManager
object that is used to maintain a set of shared state about
loggers and log services in the Java environment for a speciic application. his
LogManager
object helps in two main activities: managing a hierarchical namespace of logger objects and man-
aging a set of logging control properties that can be used by handlers and other logging objects to
conigure themselves.
9.4.2.4 The
LogRecord
Class
LogRecord
objects are used by the applications to pass logging requests between the logging
framework and individual log handlers. When a
LogRecord
is passed into the logging frame-
work, it logically belongs to the framework and should no longer be used or updated by the client
application. he logging framework appropriately uses the
LogRecord
objects.
9.4.2.5 The
Handler
Class
A handler object receives the log messages from a logger and exports them.
Export
essentially
means that the application might write them to a console or to a ile, send them to a network
logging service, forward them to an OS log, and so on. It is possible to turn on or of a handler
by using the
setLevel()
method. A handler can be disabled by doing a
setLevel(Level.
OFF)
and can be reenabled by doing a setLevel with an appropriate level. Also, the handler classes
typically use
LogManager
properties to set default values for the handler's ilter, formatter, and
level.
9.4.2.6 The
Formatter
Class
he formatter class provides support for formatting
LogRecords
. Each logging handler will
have a formatter (or a subclass of formatter) associated with it. he formatter takes a
LogRecord
and converts it to a string. Some formatters (such as the
XMLFormatter
) need to wrap head and
tail strings around a set of formatted records. he
getHeader()
and
getTail()
methods can
be used to obtain these strings. he
SimpleFormatter
and the
XMLFormatter
are the most
useful subclasses of formatter that can be customized for any application.
Search WWH ::
Custom Search