Java Logging: LogManager
2015-06-16 01:20
471 查看
The
java.util.logging.LogManagermanages the internal
Loggerhierarchy, and initiates the configuration of the
Logger's, either through the configuration class or configuration file.
There is only a single
LogManagerinstantiated in the whole JVM. It is a singleton, in other words. Here is how to obtain the
LogManagerinstance:
LogManager manager = LogManager.getLogManager();
You will not often need to interact directly with the
LogManager, except for a few borderline cases.
For instance, if you want to reload the configuration file, you can do so using either of these methods:
readConfiguration(); readConfiguration(inputStream);
The first method on the
LogManagersimply re-reads the configuration from file (or class), in case these has changed.
The second method on the
LogManagersimply reads the configuration from the given
InputStream.
You can also get access to an MXBean (Java Management Extensions) from the
LogManagerusing the method
getLoggingMXBean(). Here is an example:
LoggingMXBean mxBean = logManager.getLoggingMXBean();
The
LogManagerhas more methods than these two, but most often you will not need them. Check the official JavaDoc for more information, if you need to do something not covered here.
相关文章推荐
- Java Logging: Configuration
- Java Logging: LogRecord
- Java中Comparable和Comparator实现对象比较
- Java Logging API - Tutorial
- Spring如何解决循环依赖
- Java Logging: Handlers
- Java事件监听机制
- Java Logging: Filters
- Java Logging: Formatters
- Java Logging: Log Levels
- Java Logging: Logger Hierarchy
- Java Logging: Logger
- java笔记15 多线程2(线程通信、Lock)
- java使用dom4j解析xml字符串
- Java Logging: Basic Usage
- myeclipse svn插件安装
- 【Java8】Java 8十个lambda表达式案例
- [Java 实现AES加密解密]
- java中的深复制和浅复制
- Java基础之数组