本文整理汇总了Java中java.util.logging.Level.parse方法的典型用法代码示例。如果您正苦于以下问题:Java Level.parse方法的具体用法?Java Level.parse怎么用?Java Level.parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.logging.Level
的用法示例。
在下文中一共展示了Level.parse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AgentLogger
import java.util.logging.Level; //导入方法依赖的package包/类
@Inject
public AgentLogger(IAgentId agentId) {
super(agentId);
this.categories = new LogCategories();
String level = Pogamut.getPlatform().getProperty(PogamutProperty.POGAMUT_LOGGER_LEVEL_DEFAULT.getKey());
Level logLevel;
if (level == null) {
System.err.println("No default level for AgentLogger is specified! Setting WARNING.");
logLevel = Level.WARNING;
} else {
try {
logLevel = Level.parse(level);
} catch (Exception e) {
System.err.println("Default AgentLogger level is malformed, could not par log level from: " + level);
System.err.println("Setting log level to WARNING.");
logLevel = Level.WARNING;
}
}
if (logLevel != null) {
setLevel(logLevel);
} else {
setLevel(Level.WARNING);
}
}
示例2: toJULLogLevel
import java.util.logging.Level; //导入方法依赖的package包/类
private Level toJULLogLevel(String logLevel) {
if (logLevel == null) {
return null;
}
try {
return Level.parse(logLevel);
}
catch (IllegalArgumentException e) {
if (logLevel.equalsIgnoreCase("DEBUG")) {
return Level.FINE;
}
if (logLevel.equalsIgnoreCase("WARN")) {
return Level.WARNING;
}
throw new IllegalArgumentException("Unresolved log level " + logLevel + " for java.util.logging", e);
}
}
开发者ID:gavlyukovskiy,项目名称:spring-boot-data-source-decorator,代码行数:18,代码来源:ProxyDataSourceBuilderConfigurer.java
示例3: initialize
import java.util.logging.Level; //导入方法依赖的package包/类
/**
* Initialization function that is called to instantiate the logging system. It takes
* logger names (keys) and logging labels respectively
*
* @param map a map where the key is a logger name and the value a logging level
* @throws IllegalArgumentException if level or names cannot be parsed
*/
private void initialize(final Map<String, String> logMap) throws IllegalArgumentException {
try {
for (final Entry<String, String> entry : logMap.entrySet()) {
Level level;
final String name = lastPart(entry.getKey());
final String levelString = entry.getValue().toUpperCase(Locale.ENGLISH);
final boolean isQuiet;
if ("".equals(levelString)) {
level = Level.INFO;
isQuiet = false;
} else if ("QUIET".equals(levelString)) {
level = Level.INFO;
isQuiet = true;
} else {
level = Level.parse(levelString);
isQuiet = false;
}
loggers.put(name, new LoggerInfo(level, isQuiet));
}
} catch (final IllegalArgumentException | SecurityException e) {
throw e;
}
}
示例4: getLevelValue
import java.util.logging.Level; //导入方法依赖的package包/类
private Level getLevelValue(String propertyName) {
Level retVal = null;
String stringValue = System.getProperty(propertyName);
if (stringValue != null) {
// if value is not null => property is set, we will try to override the default logging level
LOGGER.fine(TubelineassemblyMessages.MASM_0018_MSG_LOGGING_SYSTEM_PROPERTY_SET_TO_VALUE(propertyName, stringValue));
try {
retVal = Level.parse(stringValue);
} catch (IllegalArgumentException ex) {
LOGGER.warning(TubelineassemblyMessages.MASM_0019_MSG_LOGGING_SYSTEM_PROPERTY_ILLEGAL_VALUE(propertyName, stringValue), ex);
}
}
return retVal;
}
示例5: getLogLevel
import java.util.logging.Level; //导入方法依赖的package包/类
private static Level getLogLevel(final String logLevelString) {
try {
String logLevelAsString = StringUtils.isBlank(logLevelString) ? "" : logLevelString.trim(); // trim
// spaces
// if
// any
// To support level NONE, used by GemFire
if ("NONE".equalsIgnoreCase(logLevelAsString)) {
logLevelAsString = Level.OFF.getName();
}
// To support level ERROR, used by GemFire, fall to WARNING
if ("ERROR".equalsIgnoreCase(logLevelAsString)) {
logLevelAsString = Level.WARNING.getName();
}
return Level.parse(logLevelAsString.toUpperCase());
} catch (IllegalArgumentException e) {
System.out.println(e.getMessage());
return DEFAULT_LOGLEVEL;
}
}
示例6: buildFromArgs
import java.util.logging.Level; //导入方法依赖的package包/类
/**
* Creates task from command line arguments.
*
* @param args Command line arguments.
* @return Task built from command line arguments.
*/
@Deprecated
public static NavigationEvaluationTask buildFromArgs(String[] args) {
//TODO: Check validity of args?
if (args.length == 8) {
return new NavigationEvaluationTask(args[0], args[1], args[2], Boolean.parseBoolean(args[3]), Integer.parseInt(args[4]), args[5], RecordType.valueOf(args[6]), Level.parse(args[7]));
}
return new NavigationEvaluationTask();
}
示例7: getLogLevel
import java.util.logging.Level; //导入方法依赖的package包/类
private Level getLogLevel(JSONObject query) {
JSONObject prefs;
if (query.has("requiredCapabilities") && query.getJSONObject("requiredCapabilities").has("loggingPrefs")) {
prefs = query.getJSONObject("requiredCapabilities").getJSONObject("loggingPrefs");
} else if (query.has("desiredCapabilities") && query.getJSONObject("desiredCapabilities").has("loggingPrefs")) {
prefs = query.getJSONObject("desiredCapabilities").getJSONObject("loggingPrefs");
} else {
return Level.ALL;
}
if (prefs.has("driver")) {
return Level.parse(prefs.getString("driver"));
}
return Level.ALL;
}
示例8: asLogRecord
import java.util.logging.Level; //导入方法依赖的package包/类
public static LogRecord asLogRecord(SerializableLogRecord serializableLogRecord) {
LogRecord logRecord = new LogRecord(Level.parse(serializableLogRecord.level), serializableLogRecord.message);
logRecord.setLoggerName(serializableLogRecord.loggerName);
logRecord.setMillis(serializableLogRecord.millis);
logRecord.setThrown(JsonLogRecordThrowable.fromJsonString(serializableLogRecord.thrown));
return logRecord;
}
示例9: MessageDumpingFeature
import java.util.logging.Level; //导入方法依赖的package包/类
@FeatureConstructor({"enabled", "messageLoggingRoot", "messageLoggingLevel", "storeMessages"})
public MessageDumpingFeature(boolean enabled, String msgLogRoot, String msgLogLevel, boolean storeMessages) {
// this constructor is here just to satisfy JAX-WS specification requirements
this(msgLogRoot, Level.parse(msgLogLevel), storeMessages);
super.enabled = enabled;
}
示例10: parseLevel
import java.util.logging.Level; //导入方法依赖的package包/类
static Level parseLevel(String lev) {
return "USER".equals(lev) ? Level.SEVERE : Level.parse(lev);
}
示例11: getLogLevel
import java.util.logging.Level; //导入方法依赖的package包/类
public Level getLogLevel() {
Level level = Level.parse(properties.getProperty("log.level"));
return level;
}
示例12: checkRootCollection
import java.util.logging.Level; //导入方法依赖的package包/类
private void checkRootCollection(Collection<? extends URL> roots) {
if (!shouldDoNothing || roots.isEmpty() || getCancelRequest().isRaised()) {
return;
}
int stubCount = 0;
// ignore all files, which reside in IDE installation (in various clusters)
// the ignored files must be located 1 subdirectory beneath the cluster
// directory
for (URL u : roots) {
String path = u.getPath();
if (path == null || !path.endsWith("stubs.zip!/")) { // NOI18N
break;
}
FileObject f = URLMapper.findFileObject(u);
if (f == null) {
break;
}
// !/ is a root inside archive, get the archive which encapsulates it -> normal FS
FileObject archive = FileUtil.getArchiveFile(f);
// quick check - if the archive is not on OS FS, bail out.
if (archive == null) {
break;
}
final File archiveFile = FileUtil.toFile(archive);
if (archiveFile == null) {
break;
}
// 1 level up = dir-in-cluster. 2 levels up = cluster dir
FileObject parent = archive.getParent();
if (parent == null) {
break;
}
parent = parent.getParent();
if (parent == null) {
break;
}
String clusterPath = FileUtil.getRelativePath(parent, archive);
File file = InstalledFileLocator.getDefault().locate(clusterPath, null, false);
if (file == null || !file.equals(archiveFile)) {
break;
}
stubCount++;
}
if (stubCount == roots.size()) {
return;
}
if (previousLevel == null) {
previousLevel = LOGGER.getLevel() == null ? Level.ALL : LOGGER.getLevel();
Level toSet;
try {
toSet = Level.parse(System.getProperty("RepositoryUpdate.increasedLogLevel", "FINE"));
} catch (IllegalArgumentException ex) {
toSet = Level.FINE;
}
LOGGER.setLevel(toSet);
LOGGER.warning("Non-empty roots encountered while no projects are opened; loglevel increased");
Collection<? extends PathRecognizer> recogs = Lookup.getDefault().lookupAll(PathRecognizer.class);
PathRecognizerRegistry reg = PathRecognizerRegistry.getDefault();
dumpGlobalRegistry("Binary Libraries", reg.getBinaryLibraryIds());
dumpGlobalRegistry("Libraries", reg.getLibraryIds());
dumpGlobalRegistry("Sources", reg.getSourceIds());
}
}
示例13: getLogLevel
import java.util.logging.Level; //导入方法依赖的package包/类
public Level getLogLevel() {
return Level.parse(stringLevel);
}
示例14: getLogLevel
import java.util.logging.Level; //导入方法依赖的package包/类
public Level getLogLevel() {
return Level.parse(level);
}
示例15: NetworkLogEnvelope
import java.util.logging.Level; //导入方法依赖的package包/类
public NetworkLogEnvelope(String category, String level, String time, String message) {
this.category = category;
this.level = Level.parse(level);
this.millis = Long.valueOf(time).longValue();
this.message = message;
}