/**
* Visible version of {@link java.util.logging.LogManager#getFormatterProperty(String, java.util.logging.Formatter)} .
*
* We return an instance of the class named by the "name" property.
*
* If the property is not defined or has problems we return the defaultValue.
*/
public static Formatter getFormatterProperty(@Nonnull LogManager manager, @Nullable String name, @Nullable Formatter defaultValue) {
String val = manager.getProperty(name);
try {
if (val != null) {
Class clz = ClassLoader.getSystemClassLoader().loadClass(val);
return (Formatter) clz.newInstance();
}
} catch (Exception ex) {
// We got one of a variety of exceptions in creating the
// class or creating an instance.
// Drop through.
}
// We got an exception. Return the defaultValue.
return defaultValue;
}
LogManagerHelper.java 文件源码
java
阅读 30
收藏 0
点赞 0
评论 0
项目:syslog-java-client
作者:
评论列表
文章目录