Package java.util.logging
Class LogManager
- java.lang.Object
-
- java.util.logging.LogManager
-
public class LogManager extends Object
There is oneLogManagerobject in an application. It maintains properties about loggers and manages the hierarchy of loggers.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedLogManager()Protected constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddLogger(Logger logger)Add a named logger.LoggergetLogger(String name)Find a named logger.Enumeration<String>getLoggerNames()Get an enumeration of known logger names.static LogManagergetLogManager()Returns the LogManager object.
-
-
-
Constructor Detail
-
LogManager
protected LogManager()
Protected constructor. There must be only oneLogManagerin an application.
-
-
Method Detail
-
getLogManager
public static LogManager getLogManager()
Returns the LogManager object.- Returns:
- the LogManager
-
addLogger
public boolean addLogger(Logger logger)
Add a named logger. This method does nothing if the logger had already been added.The factory methods from
Loggercall this method for each Logger they created.- Parameters:
logger- the logger to register- Returns:
- true if the logger was registered, false if a logger with the same already exists
- Throws:
NullPointerException- if the logger name is null
-
getLogger
@Nullable public Logger getLogger(String name)
Find a named logger.- Parameters:
name- name of the logger- Returns:
- the matching logger or null if there is no match
-
getLoggerNames
public Enumeration<String> getLoggerNames()
Get an enumeration of known logger names.- Returns:
- an enumeration of strings
-
-