本文整理了Java中java.util.logging.LogManager.getProperty()
方法的一些代码示例,展示了LogManager.getProperty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LogManager.getProperty()
方法的具体详情如下:
包路径:java.util.logging.LogManager
类名称:LogManager
方法名:getProperty
[英]Get the value of property with given name.
[中]获取具有给定名称的属性的值。
代码示例来源:origin: robovm/robovm
private String getStringProperty(String key, String defaultValue) {
String property = manager.getProperty(key);
return property == null ? defaultValue : property;
}
代码示例来源:origin: googleapis/google-cloud-java
private String getProperty(String propertyName) {
return manager.getProperty(className + "." + propertyName);
}
}
代码示例来源:origin: robovm/robovm
private int getIntProperty(String key, int defaultValue) {
String property = manager.getProperty(key);
int result = defaultValue;
if (property != null) {
try {
result = Integer.parseInt(property);
} catch (Exception e) {
// ignore
}
}
return result;
}
代码示例来源:origin: oracle/opengrok
public static String getFileHandlerPattern() {
return LogManager.getLogManager().getProperty("java.util.logging.FileHandler.pattern");
}
代码示例来源:origin: oracle/opengrok
public static String getFileHandlerLogPath() {
return loggerFile != null ? loggerFile : LogManager.getLogManager().getProperty("java.util.logging.FileHandler.pattern");
}
代码示例来源:origin: oracle/opengrok
private static int loggerIntProperty(String name, int def) {
String val = LogManager.getLogManager().getProperty(name);
if (val == null) {
return def;
}
try {
return Integer.parseInt(val);
} catch (NumberFormatException e) {
return def;
}
}
代码示例来源:origin: robovm/robovm
private boolean getBooleanProperty(String key, boolean defaultValue) {
String property = manager.getProperty(key);
if (property == null) {
return defaultValue;
}
boolean result = defaultValue;
if ("true".equalsIgnoreCase(property)) {
result = true;
} else if ("false".equalsIgnoreCase(property)) {
result = false;
}
return result;
}
代码示例来源:origin: apache/ignite
/**
* Returns integer property from logging configuration.
*
* @param name Property name.
* @param dfltVal Default value.
* @return Parsed property value if it is set and valid or default value otherwise.
*/
private int getIntProperty(String name, int dfltVal) {
String val = manager.getProperty(name);
if (val == null)
return dfltVal;
try {
return Integer.parseInt(val.trim());
}
catch (Exception ex) {
ex.printStackTrace();
return dfltVal;
}
}
代码示例来源:origin: robovm/robovm
/**
* Constructs a {@code SocketHandler} object using the properties read by
* the log manager, including the host name and port number. Default
* formatting uses the XMLFormatter class and level is set to ALL.
*
* @throws IOException
* if failed to connect to the specified host and port.
* @throws IllegalArgumentException
* if the host name or port number is illegal.
*/
public SocketHandler() throws IOException {
super(DEFAULT_LEVEL, null, DEFAULT_FORMATTER, null);
initSocket(LogManager.getLogManager().getProperty(
"java.util.logging.SocketHandler.host"), LogManager
.getLogManager().getProperty(
"java.util.logging.SocketHandler.port"));
}
代码示例来源:origin: apache/ignite
/**
* Returns boolean property from logging configuration.
*
* @param name Property name.
* @param dfltVal Default value.
* @return Parsed property value if it is set and valid or default value otherwise.
*/
@SuppressWarnings("SimplifiableIfStatement")
private boolean getBooleanProperty(String name, boolean dfltVal) {
String val = manager.getProperty(name);
if (val == null)
return dfltVal;
val = val.toLowerCase();
if ("true".equals(val) || "1".equals(val))
return true;
if ("false".equals(val) || "0".equals(val))
return false;
return dfltVal;
}
代码示例来源:origin: robovm/robovm
String levelProperty = manager.getProperty(name + ".level");
if (levelProperty != null) {
try {
String handlersProperty = manager.getProperty(handlersPropertyName);
if (handlersProperty != null) {
for (String handlerName : handlersProperty.split(",|\\s")) {
String level = manager.getProperty(handlerName + ".level");
if (level != null) {
handler.setLevel(Level.parse(level));
代码示例来源:origin: robovm/robovm
String className = this.getClass().getName();
final String targetName = manager.getProperty(className + ".target");
try {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
String sizeString = manager.getProperty(className + ".size");
if (sizeString != null) {
try {
String pushName = manager.getProperty(className + ".push");
if (pushName != null) {
try {
代码示例来源:origin: robovm/robovm
setParent(logger, parent);
break;
} else if (getProperty(parentName + ".level") != null ||
getProperty(parentName + ".handlers") != null) {
parent = Logger.getLogger(parentName);
setParent(logger, parent);
代码示例来源:origin: oracle/opengrok
return;
String formatter = LogManager.getLogManager().getProperty("java.util.logging.FileHandler.formatter");
newFileHandler.setLevel(fileHandler.getLevel());
try {
代码示例来源:origin: oracle/opengrok
String formatter = LogManager.getLogManager().getProperty("java.util.logging.FileHandler.formatter");
try {
fh.setFormatter((Formatter) Class.forName(formatter).getDeclaredConstructor().newInstance());
代码示例来源:origin: robovm/robovm
final String filterName = manager.getProperty(prefix + ".filter");
if (filterName != null) {
try {
String levelName = manager.getProperty(prefix + ".level");
if (levelName != null) {
try {
final String formatterName = manager.getProperty(prefix + ".formatter");
if (formatterName != null) {
try {
final String encodingName = manager.getProperty(prefix + ".encoding");
try {
internalSetEncoding(encodingName);
代码示例来源:origin: apache/ignite
String ptrn = manager.getProperty(clsName + ".pattern");
代码示例来源:origin: camunda/camunda-bpm-platform
private String getProperty(String name, String defaultValue) {
String value = LogManager.getLogManager().getProperty(name);
if (value == null) {
value = defaultValue;
} else {
value = value.trim();
}
return value;
}
代码示例来源:origin: camunda/camunda-bpm-platform
public static void readJavaUtilLoggingConfigFromClasspath() {
InputStream inputStream = ReflectUtil.getResourceAsStream("logging.properties");
try {
if (inputStream != null) {
LogManager.getLogManager().readConfiguration(inputStream);
String redirectCommons = LogManager.getLogManager().getProperty("redirect.commons.logging");
if ((redirectCommons != null) && (!redirectCommons.equalsIgnoreCase("false"))) {
System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.Jdk14Logger");
}
}
} catch (Exception e) {
throw new PvmException("couldn't initialize logging properly", e);
} finally {
IoUtil.closeSilently(inputStream);
}
}
代码示例来源:origin: camunda/camunda-bpm-platform
public static void readJavaUtilLoggingConfigFromClasspath() {
InputStream inputStream = ReflectUtil.getResourceAsStream("logging.properties");
try {
if (inputStream != null) {
LogManager.getLogManager().readConfiguration(inputStream);
String redirectCommons = LogManager.getLogManager().getProperty("redirect.commons.logging");
if ((redirectCommons != null) && (!redirectCommons.equalsIgnoreCase("false"))) {
System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.Jdk14Logger");
}
}
} catch (Exception e) {
throw new PvmException("couldn't initialize logging properly", e);
} finally {
IoUtil.closeSilently(inputStream);
}
}
内容来源于网络,如有侵权,请联系作者删除!