【发布时间】:2013-10-29 17:45:02
【问题描述】:
我想加载属性文件和命令行参数,然后在运行时动态配置日志记录,我以前可以这样做:
Properties configuration;
...
ByteArrayOutputStream os = new ByteArrayOutputStream();
ByteArrayInputStream is;
byte[] buf;
try {
configuration.store(os, "logging");
buf = os.toByteArray();
is = new ByteArrayInputStream(buf);
java.util.logging.LogManager.getLogManager().readConfiguration(is);
} catch (IOException e) {
System.err.println("Failed to configure java.util.logging.LogManager");
}
Properties 很好,但可以使用 PropertiesConfiguration 来完成吗?
(仅供参考,我希望利用 commons-configuration 提供的属性数组)
【问题讨论】:
标签: java apache-commons java.util.logging