本文整理了Java中java.util.logging.Logger.warning()
方法的一些代码示例,展示了Logger.warning()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.warning()
方法的具体详情如下:
包路径:java.util.logging.Logger
类名称:Logger
方法名:warning
[英]Log a WARNING message.
If the logger is currently enabled for the WARNING message level then the given message is forwarded to all the registered output Handler objects.
[中]记录一条警告消息。
如果记录器当前已启用警告消息级别,则给定消息将转发到所有已注册的输出处理程序对象。
代码示例来源:origin: iBotPeaches/Apktool
@Override
public void run() {
try {
BufferedReader br = new BufferedReader(new InputStreamReader(mIn));
String line;
while ((line = br.readLine()) != null) {
if (mType.equals("OUTPUT")) {
LOGGER.info(line);
} else {
LOGGER.warning(line);
}
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
代码示例来源:origin: EngineHub/WorldEdit
@Override
protected void finalize() throws Throwable {
super.finalize();
if (commitRequired()) {
WorldEdit.logger.warning("####### LEFTOVER BUFFER BLOCKS DETECTED #######");
WorldEdit.logger.warning("This means that some code did not flush their EditSession.");
WorldEdit.logger.log(Level.WARNING, "Here is a stacktrace from the creation of this EditSession:", stacktrace);
}
}
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Creates a hudson.PluginStrategy, looking at the corresponding system property.
*/
protected PluginStrategy createPluginStrategy() {
String strategyName = SystemProperties.getString(PluginStrategy.class.getName());
if (strategyName != null) {
try {
Class<?> klazz = getClass().getClassLoader().loadClass(strategyName);
Object strategy = klazz.getConstructor(PluginManager.class)
.newInstance(this);
if (strategy instanceof PluginStrategy) {
LOGGER.info("Plugin strategy: " + strategyName);
return (PluginStrategy) strategy;
} else {
LOGGER.warning("Plugin strategy (" + strategyName +
") is not an instance of hudson.PluginStrategy");
}
} catch (ClassNotFoundException e) {
LOGGER.warning("Plugin strategy class not found: "
+ strategyName);
} catch (Exception e) {
LOGGER.log(WARNING, "Could not instantiate plugin strategy: "
+ strategyName + ". Falling back to ClassicPluginStrategy", e);
}
LOGGER.info("Falling back to ClassicPluginStrategy");
}
// default and fallback
return new ClassicPluginStrategy(this);
}
代码示例来源:origin: com.google.protobuf/protobuf-java
/**
* This method is to be called by generated code only. It uses Java
* reflection to load the dependencies' descriptors.
*/
public static void internalBuildGeneratedFileFrom(
final String[] descriptorDataParts,
final Class<?> descriptorOuterClass,
final String[] dependencies,
final String[] dependencyFileNames,
final InternalDescriptorAssigner descriptorAssigner) {
List<FileDescriptor> descriptors = new ArrayList<FileDescriptor>();
for (int i = 0; i < dependencies.length; i++) {
try {
Class<?> clazz =
descriptorOuterClass.getClassLoader().loadClass(dependencies[i]);
descriptors.add(
(FileDescriptor) clazz.getField("descriptor").get(null));
} catch (Exception e) {
// We allow unknown dependencies by default. If a dependency cannot
// be found we only generate a warning.
logger.warning("Descriptors for \"" + dependencyFileNames[i] +
"\" can not be found.");
}
}
FileDescriptor[] descriptorArray = new FileDescriptor[descriptors.size()];
descriptors.toArray(descriptorArray);
internalBuildGeneratedFileFrom(
descriptorDataParts, descriptorArray, descriptorAssigner);
}
代码示例来源:origin: twosigma/beakerx
public void taskStart(int stageId, long taskId) {
if (!stages.containsKey(stageId)) {
logger.warning(String.format("Spark stage %d could not be found for task progress reporting.", stageId));
return;
}
removeTask(stageId, taskId);
List<Long> at = activeTasks.getOrDefault(stageId, new ArrayList<Long>());
at.add(taskId);
activeTasks.put(stageId, at);
}
代码示例来源:origin: hankcs/HanLP
logger.info("自定义词典开始加载:" + mainPath);
if (loadDat(mainPath, dat)) return true;
TreeMap<String, CoreDictionary.Attribute> map = new TreeMap<String, CoreDictionary.Attribute>();
logger.info("以默认词性[" + defaultNature + "]加载自定义词典" + p + "中……");
boolean success = load(p, defaultNature, map, customNatureCollector);
if (!success) logger.warning("失败:" + p);
logger.warning("没有加载到任何词条");
logger.info("正在构建DoubleArrayTrie……");
dat.build(map);
if (isCache)
for (Map.Entry<String, CoreDictionary.Attribute> entry : map.entrySet())
attributeList.add(entry.getValue());
out.writeInt(attributeList.size());
for (CoreDictionary.Attribute attribute : attributeList)
logger.warning("自定义词典" + mainPath + "缓存失败!\n" + TextUtility.exceptionToString(e));
代码示例来源:origin: 4thline/cling
errors.add(new ValidationError(
getClass(),
"serviceType",
errors.add(new ValidationError(
getClass(),
"serviceId",
if(actionErrors.size() > 0) {
log.warning("Discarding invalid action of service '" + getServiceId() + "': " + action.getName());
for (ValidationError actionError : actionErrors) {
log.warning("Invalid action '" + action.getName() + "': " + actionError);
代码示例来源:origin: stanfordnlp/CoreNLP
additionalLinksCount = 0;
for (int sentI = 0; sentI < orderedMentionsBySentence.size(); sentI++) {
List<Mention> orderedMentions = orderedMentionsBySentence.get(sentI);
for (int mentionI = 0; mentionI < orderedMentions.size(); mentionI++) {
for(int i = 0; i < l.size(); i++) {
for(int j = 0; j < l.size(); j++) {
if(l.get(i).headString.equals(l.get(j).headString) &&
CorefCluster c2 = corefClusters.get(m2.corefClusterID);
if (c2 == null) {
logger.warning("NO corefcluster id " + m2.corefClusterID);
if(currentSieve==0) {
scoreSingleDoc = new ArrayList<>();
scoreSingleDoc.add(new ScorerPairwise());
scoreSingleDoc.get(currentSieve).calculateScore(document);
additionalCorrectLinksCount = (int) scoreSingleDoc.get(currentSieve).precisionNumSum;
additionalLinksCount = (int) scoreSingleDoc.get(currentSieve).precisionDenSum;
} else {
scoreSingleDoc.add(new ScorerPairwise());
scoreSingleDoc.get(currentSieve).calculateScore(document);
additionalCorrectLinksCount = (int) (scoreSingleDoc.get(currentSieve).precisionNumSum - scoreSingleDoc.get(currentSieve-1).precisionNumSum);
代码示例来源:origin: 4thline/cling
protected void execute() throws RouterException {
List<NetworkAddress> activeStreamServers =
getUpnpService().getRouter().getActiveStreamServers(null);
if (activeStreamServers.size() == 0) {
log.fine("Aborting notifications, no active stream servers found (network disabled?)");
return;
}
// Prepare it once, it's the same for each repetition
List<Location> descriptorLocations = new ArrayList<>();
for (NetworkAddress activeStreamServer : activeStreamServers) {
descriptorLocations.add(
new Location(
activeStreamServer,
getUpnpService().getConfiguration().getNamespace().getDescriptorPathString(getDevice())
)
);
}
for (int i = 0; i < getBulkRepeat(); i++) {
try {
for (Location descriptorLocation : descriptorLocations) {
sendMessages(descriptorLocation);
}
// UDA 1.0 is silent about this but UDA 1.1 recomments "a few hundred milliseconds"
log.finer("Sleeping " + getBulkIntervalMilliseconds() + " milliseconds");
Thread.sleep(getBulkIntervalMilliseconds());
} catch (InterruptedException ex) {
log.warning("Advertisement thread was interrupted: " + ex);
}
}
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Lists up additional bundled plugins from the system property {@code hudson.bundled.plugins}.
* Since 1.480 glob syntax is supported.
* For use in the "mvn hudson-dev:run".
* TODO: maven-hpi-plugin should inject its own InitStrategy instead of having this in the core.
*/
protected void getBundledPluginsFromProperty(final List<File> r) {
String hplProperty = SystemProperties.getString("hudson.bundled.plugins");
if (hplProperty != null) {
for (String hplLocation : hplProperty.split(",")) {
File hpl = new File(hplLocation.trim());
if (hpl.exists()) {
r.add(hpl);
} else if (hpl.getName().contains("*")) {
try {
new DirScanner.Glob(hpl.getName(), null).scan(hpl.getParentFile(), new FileVisitor() {
@Override public void visit(File f, String relativePath) throws IOException {
r.add(f);
}
});
} catch (IOException x) {
LOGGER.log(Level.WARNING, "could not expand " + hplLocation, x);
}
} else {
LOGGER.warning("bundled plugin " + hplLocation + " does not exist");
}
}
}
}
代码示例来源:origin: hankcs/HanLP
logger.warning("读取" + path + "失败" + e);
return false;
for (Map.Entry<String, V> entry : entrySet)
keyList.add(entry.getKey());
valueList.add(entry.getValue());
logger.warning("trie建立失败");
return false;
logger.info(path + "加载成功,耗时" + (System.currentTimeMillis() - start) + "ms");
saveDat(path + BIN_EXT, valueList);
return true;
代码示例来源:origin: geoserver/geoserver
if (!(appender instanceof ConsoleAppender || appender instanceof FileAppender)) {
appenders.add(appender);
logFileName =
new File(loader.getBaseDirectory(), logFileName).getAbsolutePath();
LoggingInitializer.LOGGER.fine(
"Non-absolute pathname detected for logfile. Setting logfile relative to data dir.");
LoggingInitializer.LOGGER.fine("Logging output to file '" + logFileName + "'");
} else if (gslf != null) {
LoggingInitializer.LOGGER.warning(
"'log4j.appender.geoserverlogfile' appender is defined, but isn't a FileAppender. GeoServer won't control the file-based logging.");
} else {
LoggingInitializer.LOGGER.warning(
"'log4j.appender.geoserverlogfile' appender isn't defined. GeoServer won't control the file-based logging.");
LoggingInitializer.LOGGER.info(
"Suppressing StdOut logging. If you want to see GeoServer logs, be sure to look in '"
+ logFileName
LogManager.getRootLogger().addAppender(appender);
LoggingInitializer.LOGGER.fine(
"FINISHED CONFIGURING GEOSERVER LOGGING -------------------------");
代码示例来源:origin: jersey/jersey
if (LOG.isLoggable(Level.FINE)) {
LOG.fine("Skipping empty inline tag of @response.param in method "
+ methodDoc.qualifiedName() + ": " + tagName);
break;
default:
LOG.warning("Unknown inline tag of @response.param in method "
+ methodDoc.qualifiedName() + ": " + tagName
+ " (value: " + tagText + ")");
responseDoc.getWadlParams().add(wadlParam);
representationDoc.setDoc(tag.text());
} else {
LOG.warning("Unknown response representation tag " + tag.name());
responseDoc.getRepresentations().add(representationDoc);
代码示例来源:origin: sohutv/cachecloud
boolean sentinelAvailable = false;
log.info("Trying to find master from available Sentinels...");
log.fine("Connecting to Sentinel " + hap);
if (masterAddr == null || masterAddr.size() != 2) {
log.warning("Can not get master addr, master name: " + masterName + ". Sentinel: " + hap
+ ".");
continue;
log.fine("Found Redis master at " + master);
break;
} catch (JedisException e) {
log.warning("Cannot get master address from sentinel running @ " + hap + ". Reason: " + e
+ ". Trying next one.");
} finally {
log.info("Redis master running at " + master + ", starting Sentinel listeners...");
代码示例来源:origin: stanfordnlp/CoreNLP
logger.fine(timeStamp);
logger.fine(props.toString());
Constants.printConstants(logger);
logger.warning("No mention finder specified, but not using gold mentions");
runAndScoreCoref(corefSystem, mentionExtractor, props, timeStamp);
} catch (Exception ex) {
logger.log(Level.SEVERE, "ERROR in running coreference", ex);
logger.info("done");
String endTimeStamp = Calendar.getInstance().getTime().toString().replaceAll("\\s", "-");
logger.fine(endTimeStamp);
代码示例来源:origin: jenkinsci/jenkins
@VisibleForTesting
/*package*/ void install(Channel channel, @CheckForNull SlaveComputer c) {
if (pingTimeoutSeconds < 1 || pingIntervalSeconds < 1) {
LOGGER.warning("Agent ping is disabled");
return;
}
// set up ping from both directions, so that in case of a router dropping a connection,
// both sides can notice it and take compensation actions.
try {
channel.call(new SetUpRemotePing(pingTimeoutSeconds, pingIntervalSeconds));
LOGGER.fine("Set up a remote ping for " + channel.getName());
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "Failed to set up a ping for " + channel.getName(), e);
}
setUpPingForChannel(channel, c, pingTimeoutSeconds, pingIntervalSeconds, true);
}
代码示例来源:origin: shyiko/mysql-binlog-connector-java
@Override
public void run() {
try {
connectLatch.await(timeout, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
if (logger.isLoggable(Level.WARNING)) {
logger.log(Level.WARNING, e.getMessage());
}
}
if (connectLatch.getCount() != 0) {
if (logger.isLoggable(Level.WARNING)) {
logger.warning("Failed to establish connection in " + timeout + "ms. " +
"Forcing disconnect.");
}
try {
self.disconnectChannel();
} catch (IOException e) {
if (logger.isLoggable(Level.WARNING)) {
logger.log(Level.WARNING, e.getMessage());
}
}
}
}
}, "blc-disconnect-" + hostname + ":" + port);
代码示例来源:origin: cmusphinx/sphinx4
/**
* Builds the map from unigram to unigramID. Also finds the startWordID and
* endWordID.
*
* @param dictionary
* */
private void buildUnigramIDMap() {
int missingWords = 0;
if (unigramIDMap == null)
unigramIDMap = new HashMap<Word, Integer>();
for (int i = 0; i < words.length; i++) {
Word word = dictionary.getWord(words[i]);
if (word == null) {
logger.warning("The dictionary is missing a phonetic transcription for the word '"
+ words[i] + "'");
missingWords++;
}
unigramIDMap.put(word, i);
if (logger.isLoggable(Level.FINE))
logger.fine("Word: " + word);
}
if (missingWords > 0)
logger.warning("Dictionary is missing " + missingWords
+ " words that are contained in the language model.");
}
代码示例来源:origin: chewiebug/GCViewer
/**
* Save properties to a file.
*/
public void store() {
try (BufferedWriter writer = new BufferedWriter(new FileWriter(getPreferencesFile()))) {
properties.store(writer, "GCViewer preferences");
}
catch (IOException e) {
if (LOGGER.isLoggable(Level.WARNING)) {
LOGGER.warning("could not store preferences (" + e.toString() + ")");
}
}
}
代码示例来源:origin: SonarSource/sonarqube
julLogger.finest("Message1");
julLogger.finer("Message1");
julLogger.fine("Message1");
julLogger.info("Message1");
julLogger.warning("Message1");
julLogger.severe("Message1");
julLogger.fine("Message2");
julLogger.info("Message2");
julLogger.warning("Message2");
julLogger.severe("Message2");
assertThat(julLogger.isLoggable(java.util.logging.Level.FINEST)).isTrue();
assertThat(julLogger.isLoggable(java.util.logging.Level.FINER)).isTrue();
assertThat(julLogger.isLoggable(java.util.logging.Level.FINE)).isTrue();
assertThat(julLogger.isLoggable(java.util.logging.Level.INFO)).isTrue();
assertThat(julLogger.isLoggable(java.util.logging.Level.SEVERE)).isTrue();
julLogger.fine("Message3");
julLogger.info("Message3");
julLogger.warning("Message3");
julLogger.severe("Message3");
内容来源于网络,如有侵权,请联系作者删除!