本文整理了Java中java.util.logging.Logger.info()
方法的一些代码示例,展示了Logger.info()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.info()
方法的具体详情如下:
包路径:java.util.logging.Logger
类名称:Logger
方法名:info
[英]Log an INFO message.
If the logger is currently enabled for the INFO message level then the given message is forwarded to all the registered output Handler objects.
[中]记录一条信息消息。
如果记录器当前已启用信息消息级别,则给定消息将转发到所有已注册的输出处理程序对象。
代码示例来源:origin: square/okhttp
@Override protected void execute() {
try {
processConnection();
} catch (IOException e) {
logger.info(
MockWebServer.this + " connection from " + raw.getInetAddress() + " failed: " + e);
} catch (Exception e) {
logger.log(Level.SEVERE,
MockWebServer.this + " connection from " + raw.getInetAddress() + " crashed", e);
}
}
代码示例来源:origin: stackoverflow.com
import java.util.logging.Logger;
public class Main {
private static Logger LOGGER = Logger.getLogger("InfoLogging");
public static void main(String[] args) {
LOGGER.info("Logging an INFO-level message");
}
}
代码示例来源: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: gocd/gocd
arguments.add(defaultJava);
arguments.add("-Xms" + startMem + "m");
arguments.add("-Xmx" + maxMem + "m");
arguments.add("-XX:MaxMetaspaceSize=" + maxPerm + "m");
if (dbDebugMode) {
arguments.add("-jar");
arguments.add(new File(getClass().getProtectionDomain().getCodeSource().getLocation().toURI().getPath()).getAbsolutePath());
LOG.info("Running server as: " + arguments);
String[] args = arguments.toArray(new String[arguments.size()]);
代码示例来源: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)
logger.info("正在缓存词典为dat文件……");
attributeList.add(entry.getValue());
out.writeInt(attributeList.size());
for (CoreDictionary.Attribute attribute : attributeList)
logger.warning("自定义词典" + mainPath + "缓存失败!\n" + TextUtility.exceptionToString(e));
代码示例来源:origin: chewiebug/GCViewer
public GCModel read() throws IOException {
if (getLogger().isLoggable(Level.INFO)) getLogger().info("Reading Sun 1.3.1 format...");
try {
count = 0;
char c = (char) i;
if (c == '[') {
if (line != null) lineStack.add(line); // push
line = new StringBuilder(64);
if (getLogger().isLoggable(Level.WARNING)) getLogger().log(Level.WARNING, e.getMessage(), e);
e.printStackTrace();
line = lineStack.remove(lineStack.size() - 1); // pop
if (getLogger().isLoggable(Level.INFO)) getLogger().info("Done reading.");
代码示例来源:origin: stanfordnlp/CoreNLP
public List<String> annotateMulticlass(List<Datum<String, String>> testDatums) {
List<String> predictedLabels = new ArrayList<>();
for (Datum<String, String> testDatum: testDatums) {
String label = classOf(testDatum, null);
Counter<String> probs = probabilityOf(testDatum);
double prob = probs.getCount(label);
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
if (logger.isLoggable(Level.FINE)) {
justificationOf(testDatum, pw, label);
}
logger.fine("JUSTIFICATION for label GOLD:" + testDatum.label() + " SYS:" + label + " (prob:" + prob + "):\n"
+ sw.toString() + "\nJustification done.");
predictedLabels.add(label);
if(! testDatum.label().equals(label)){
logger.info("Classification: found different type " + label + " for relation: " + testDatum);
} else{
logger.info("Classification: found similar type " + label + " for relation: " + testDatum);
}
}
return predictedLabels;
}
代码示例来源:origin: jersey/jersey
private static List<JavaFile> getJavaFiles(File configFile) throws Exception {
final List<JavaFile> javaFiles = new LinkedList<>();
try (BufferedReader r = new BufferedReader(new InputStreamReader(new FileInputStream(configFile), "UTF-8"))) {
while (r.ready()) {
final String className = r.readLine();
if (!className.startsWith("#")) {
javaFiles.add(new JavaFile(className, SRC_MAIN_JAVA));
LOGGER.info(String.format(" + included class %s.\n", className));
} else {
LOGGER.info(String.format(" - ignored class %s\n", className.substring(1)));
}
}
}
return javaFiles;
}
代码示例来源:origin: stanfordnlp/CoreNLP
cmd.add("-props");
cmd.add(propsFile);
ProcessBuilder pb = new ProcessBuilder(cmd);
pbEnv.putAll(curEnv);
logger.info("Running distributed coref:" + StringUtils.join(pb.command(), " "));
StringWriter outSos = new StringWriter();
StringWriter errSos = new StringWriter();
String outStr = outSos.toString();
String errStr = errSos.toString();
logger.info("Finished distributed coref: " + runDistCmd + ", props=" + propsFile);
logger.info("Output: " + outStr);
if (errStr.length() > 0) {
logger.info("Error: " + errStr);
代码示例来源:origin: jenkinsci/jenkins
File classes = new File(expandDir, "WEB-INF/classes");
if (classes.exists()) { // should not normally happen, due to createClassJarFromWebInfClasses
LOGGER.log(Level.WARNING, "Deprecated unpacked classes directory found in {0}", classes);
paths.add(classes);
LOGGER.info("Plugin " + archive.getName() + " is disabled");
PluginWrapper.Dependency d = new PluginWrapper.Dependency(s);
if (d.optional) {
optionalDependencies.add(d);
} else {
dependencies.add(d);
代码示例来源: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: 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
/**
* 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: peter-lawrey/Java-Chronicle
@Nullable
private SocketChannel createConnection() {
while (!closed) {
try {
readBuffer.clear();
readBuffer.limit(0);
SocketChannel sc = SocketChannel.open(address);
sc.socket().setReceiveBufferSize(256 * 1024);
logger.info("Connected to " + address);
ByteBuffer bb = ByteBuffer.allocate(8);
bb.putLong(0, chronicle.size());
IOTools.writeAllOrEOF(sc, bb);
return sc;
} catch (IOException e) {
if (logger.isLoggable(Level.FINE))
logger.log(Level.FINE, "Failed to connect to " + address + " retrying", e);
else if (logger.isLoggable(Level.INFO))
logger.log(Level.INFO, "Failed to connect to " + address + " retrying " + e);
}
try {
Thread.sleep(500);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return null;
}
}
return null;
}
代码示例来源:origin: stanfordnlp/CoreNLP
Redwood.startTrack("Adaptor test controlled by redwood");
Logger topLogger = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
topLogger.warning("I'm warning you!");
topLogger.severe("Now I'm using my severe voice.");
topLogger.info("FYI");
topLogger.warning("I'm warning you in Redwood!");
topLogger.info("FYI: Redwood rocks");
} else {
Logger topLogger = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME); // Can be Logger.getGlobal() in jdk1.7
Logger logger = Logger.getLogger(JavaUtilLoggingAdaptor.class.getName());
topLogger.info("Starting test");
logger.log(Level.INFO, "Hello from the class logger");
Redwood.log("Hello from Redwood -> Java!");
Redwood.log("Hello from Redwood -> Java again!");
logger.log(Level.INFO, "Hello again from the class logger");
Redwood.startTrack("a track");
Redwood.log("Inside a track");
logger.log(Level.INFO, "Hello a third time from the class logger");
Redwood.endTrack("a track");
logger.log(Level.INFO, "Hello a fourth time from the class logger");
代码示例来源:origin: 4thline/cling
/**
* Called when a received event message could not be parsed successfully.
* <p>
* This typically indicates a broken device which is not UPnP compliant. You can
* react to this failure in any way you like, for example, you could terminate
* the subscription or simply create an error report/log.
* </p>
* <p>
* The default implementation will log the exception at <code>INFO</code> level, and
* the invalid XML at <code>FINE</code> level.
* </p>
*
* @param remoteGENASubscription The established subscription.
* @param ex Call {@link org.fourthline.cling.model.UnsupportedDataException#getData()} to access the invalid XML.
*/
protected void invalidMessage(RemoteGENASubscription remoteGENASubscription,
UnsupportedDataException ex) {
log.info("Invalid event message received, causing: " + ex);
if (log.isLoggable(Level.FINE)) {
log.fine("------------------------------------------------------------------------------");
log.fine(ex.getData() != null ? ex.getData().toString() : "null");
log.fine("------------------------------------------------------------------------------");
}
}
代码示例来源:origin: SonarSource/sonarqube
underTest.getRootContext().getLogger(logbackRootLoggerName).addAppender(memoryAppender);
java.util.logging.Logger julLogger = java.util.logging.Logger.getLogger("com.ms.sqlserver.jdbc.DTV");
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");
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public void info(String msg) {
if (!impl.isLoggable(INFO))
warning("Logging at INFO level without checking if INFO level is enabled: " + msg);
impl.info(msg);
}
内容来源于网络,如有侵权,请联系作者删除!