Datasheet

The LogManager Class
The LogManager class contains methods to configure the current instance of the logging system through
a number of configuration methods, tracks loggers and provides access to these loggers, and handles
certain logging events. These methods are listed in the following tables.
Configuration
The methods listed in the following table relate to storage and retrieval of configuration information in
the
LogManager.
Method Description
String getProperty(String name) Returns the value corresponding to a specified
logging property.
void readConfiguration() Reloads the configuration using the same
process as startup. If the system properties
controlling initialization have not changed, the
same file that was read at startup will be read
here.
void readConfiguration(InputStream ins) Reads configuration information from an
InputStream that is in the java.util
.Properties
format.
void reset() Resets the logging system. All Handlers are
closed and removed and all logger levels
except on the root are set to null. The root log-
ger’s level is set to
Level.INFO.
Logger Control
The methods listed in the following table relate to the storage, retrieval, and management of individual
Logger references. These are the most commonly used methods on the LogManager class.
Method Description
static LogManager getLogManager() Returns the one and only instance of the
LogManager object.
boolean addLogger(Logger logger) Returns true if the Logger passed in is not
already registered (its name isn’t already in the
list). The logger is registered.
Returns false if the name of the
Logger object
already exists in the list of registered loggers.
Logger getLogger(String name) Returns a reference to the Logger object that is
named “name,” or null if no logger is found.
Enumeration getLoggerNames() Returns an Enumeration containing a list of
the names of all currently registered loggers.
37
Chapter 1: Key Java Language Features and Libraries
05_777106 ch01.qxp 11/28/06 10:43 PM Page 37