当前位置: 首页>>代码示例>>Java>>正文


Java Logger.finest方法代码示例

本文整理汇总了Java中java.util.logging.Logger.finest方法的典型用法代码示例。如果您正苦于以下问题:Java Logger.finest方法的具体用法?Java Logger.finest怎么用?Java Logger.finest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.logging.Logger的用法示例。


在下文中一共展示了Logger.finest方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testEarlyPublish

import java.util.logging.Logger; //导入方法依赖的package包/类
public void testEarlyPublish() throws Exception {
    EarlyHandler eh = Lookup.getDefault().lookup(EarlyHandler.class);
    Logger allLogger = Logger.getLogger("org.myapplication.ui.test_early"); // Copied Installer.UI_LOGGER_NAME, not to initialize Installer class.
    allLogger.setLevel(Level.ALL);
    allLogger.addHandler(eh);
    
    allLogger.fine("Test Message 1");
    allLogger.info("Test Message 2");
    allLogger.finest("Test Message 3");
    
    Installer installer = Installer.findObject(Installer.class, true);
    installer.restored();
    assertEquals("EarlyHandler turned off", Level.OFF, eh.getLevel());
    
    allLogger.finer("Test Message 4");
    
    List<LogRecord> logs = InstallerTest.getLogs();
    assertEquals("Number of messages logged: ", 4, logs.size());
    for (int i = 0; i < logs.size(); i++) {
        assertEquals("Test Message "+(i+1), logs.get(i).getMessage());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:EarlyHandlerTest.java

示例2: loglevel

import java.util.logging.Logger; //导入方法依赖的package包/类
public void loglevel(Level l, Logger logger, String message) {
    LogTest test = LogTest.valueOf("LEV_"+l.getName());
    switch(test) {
        case LEV_SEVERE:
            logger.severe(message);
            break;
        case LEV_WARNING:
            logger.warning(message);
            break;
        case LEV_INFO:
            logger.info(message);
            break;
        case LEV_CONFIG:
            logger.config(message);
            break;
        case LEV_FINE:
            logger.fine(message);
            break;
        case LEV_FINER:
            logger.finer(message);
            break;
        case LEV_FINEST:
            logger.finest(message);
            break;
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:27,代码来源:TestIsLoggable.java

示例3: injectClass

import java.util.logging.Logger; //导入方法依赖的package包/类
private Class<?> injectClass(String name) {
    if (name.startsWith(MY_PACKAGE)) {
        return null;
    }
    Set<String> classes = findingClasses;
    if (classes.contains(name)) {
        throw new IllegalStateException(name + " is recursively loaded");
    }
    ClassFile f;
    try {
        f = source.getClassFile(name);
    } catch (IOException e) {
        throw new IOError(e);
    }
    if (f == null) {
        return null;
    }
    classes.add(name);
    try {
        Class<?> c = f.toClass(injectionTarget);
        Logger logger = Loggers.get();
        if (logger.isLoggable(Level.FINEST)) {
            String hash = Integer.toHexString(System.identityHashCode(injectionTarget));
            String target = injectionTarget.getClass().getName() + '@' + hash;
            logger.finest("The class " + c.getName() + " was injected into " + target);
        }
        return c;
    } finally {
        classes.remove(name);
    }
}
 
开发者ID:tmurakami,项目名称:classinjector,代码行数:32,代码来源:InjectorClassLoader.java

示例4: error

import java.util.logging.Logger; //导入方法依赖的package包/类
private void error(Logger logger, Exception e, String msg) {
  	logger.severe(msg);
  	if (logger.isLoggable(Level.FINEST)) {
  		for (Throwable t = e; t != null; t = t.getCause()) {
  			logger.finest(t.getClass().getCanonicalName());
  			for (StackTraceElement ste : t.getStackTrace())
  				logger.finest("    " + ste);
  		}
  	}
else
	logger.info("use -verbose option to get debug info");
  	exitCode = 1;
  }
 
开发者ID:Bibliome,项目名称:alvisnlp,代码行数:14,代码来源:AbstractAlvisNLP.java

示例5: randomInts

import java.util.logging.Logger; //导入方法依赖的package包/类
/**
 * Convenience to aid logging uses of Randoms.
 *
 * @param logger The {@code Logger} to log to.
 * @param logMe A string to log with the result.
 * @param random A pseudo-{@code Random} number source.
 * @param range The exclusive maximum integer to return.
 * @param n The number of randoms.
 * @return A vector of pseudo-random integers r, 0 &le; r &lt; range.
 */
public static int[] randomInts(Logger logger, String logMe, Random random,
                               int range, int n) {
    int[] ret = new int[n];
    for (int i = 0; i < n; i++) ret[i] = random.nextInt(range);
    if (logger != null && logger.isLoggable(Level.FINEST)) {
        StringBuilder sb = new StringBuilder(64);
        sb.append(logMe).append(" random(").append(range).append(") = [");
        for (int i = 0; i < n; i++) sb.append(' ').append(ret[i]);
        sb.append(" ]");
        logger.finest(sb.toString());
    }
    return ret;
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:24,代码来源:RandomUtils.java

示例6: randomFloat

import java.util.logging.Logger; //导入方法依赖的package包/类
/**
 * Convenience to aid logging uses of Randoms.
 *
 * @param logger The {@code Logger} to log to.
 * @param logMe A string to log with the result.
 * @param random A pseudo-{@code Random} number source.
 * @return A pseudo-random double r, 0 &le; r &lt; 1.0.
 */
public static float randomFloat(Logger logger, String logMe,
                                Random random) {
    float ret = random.nextFloat();
    if (logger != null && logger.isLoggable(Level.FINEST)) {
        logger.finest(logMe + " random(1.0f) = " + ret);
    }
    return ret;
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:17,代码来源:RandomUtils.java

示例7: randomDouble

import java.util.logging.Logger; //导入方法依赖的package包/类
/**
 * Convenience to aid logging uses of Randoms.
 *
 * @param logger The {@code Logger} to log to.
 * @param logMe A string to log with the result.
 * @param random A pseudo-{@code Random} number source.
 * @return A pseudo-random double r, 0 &le; r &lt; 1.0.
 */
public static double randomDouble(Logger logger, String logMe,
                                  Random random) {
    double ret = random.nextDouble();
    if (logger != null && logger.isLoggable(Level.FINEST)) {
        logger.finest(logMe + " random(1.0) = " + ret);
    }
    return ret;
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:17,代码来源:RandomUtils.java

示例8: randomShuffle

import java.util.logging.Logger; //导入方法依赖的package包/类
/**
 * Shuffle a list.
 *
 * @param logger The {@code Logger} to log to.
 * @param logMe A string to log with the result.
 * @param list The list.
 * @param random A random number source.
 */
public static void randomShuffle(Logger logger, String logMe,
                                 List<?> list, Random random) {
    if (list.size() <= 1 || random == null) return;
    if (logger != null && logger.isLoggable(Level.FINEST)) {
        logger.finest(logMe + " shuffle.");
    }
    Collections.shuffle(list, random);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:17,代码来源:RandomUtils.java

示例9: test1

import java.util.logging.Logger; //导入方法依赖的package包/类
public void test1(Logger logger) {
    System.out.println("test1: " + loggerName(logger));

    AtomicInteger count = new AtomicInteger();
    assertEquals(0, TestHandler.PUBLISHED.size(), "Queue should be empty: ");
    logger.setLevel(Level.ALL);
    assertEquals(0, TestHandler.PUBLISHED.size(), "Queue should be empty: ");

    logger.severe("message " + count.incrementAndGet());
    assertEquals(1, TestHandler.PUBLISHED.size(), "No event in queue: ");
    LogEvent event = TestHandler.PUBLISHED.remove();
    assertEquals(0, TestHandler.PUBLISHED.size(), "Queue should be empty: ");
    checkEvent(event, this.getClass().getName(), "test1", "message " + count.get());

    logger.warning("message " + count.incrementAndGet());
    assertEquals(1, TestHandler.PUBLISHED.size(), "No event in queue: ");
    event = TestHandler.PUBLISHED.remove();
    assertEquals(0, TestHandler.PUBLISHED.size(), "Queue should be empty: ");
    checkEvent(event, this.getClass().getName(), "test1", "message " + count.get());

    logger.info("message " + count.incrementAndGet());
    assertEquals(1, TestHandler.PUBLISHED.size(), "No event in queue: ");
    event = TestHandler.PUBLISHED.remove();
    assertEquals(0, TestHandler.PUBLISHED.size(), "Queue should be empty: ");
    checkEvent(event, this.getClass().getName(), "test1", "message " + count.get());

    logger.config("message " + count.incrementAndGet());
    assertEquals(1, TestHandler.PUBLISHED.size(), "No event in queue: ");
    event = TestHandler.PUBLISHED.remove();
    assertEquals(0, TestHandler.PUBLISHED.size(), "Queue should be empty: ");
    checkEvent(event, this.getClass().getName(), "test1", "message " + count.get());

    logger.fine("message " + count.incrementAndGet());
    assertEquals(1, TestHandler.PUBLISHED.size(), "No event in queue: ");
    event = TestHandler.PUBLISHED.remove();
    assertEquals(0, TestHandler.PUBLISHED.size(), "Queue should be empty: ");
    checkEvent(event, this.getClass().getName(), "test1", "message " + count.get());

    logger.finer("message " + count.incrementAndGet());
    assertEquals(1, TestHandler.PUBLISHED.size(), "No event in queue: ");
    event = TestHandler.PUBLISHED.remove();
    assertEquals(0, TestHandler.PUBLISHED.size(), "Queue should be empty: ");
    checkEvent(event, this.getClass().getName(), "test1", "message " + count.get());

    logger.finest("message " + count.incrementAndGet());
    assertEquals(1, TestHandler.PUBLISHED.size(), "No event in queue: ");
    event = TestHandler.PUBLISHED.remove();
    assertEquals(0, TestHandler.PUBLISHED.size(), "Queue should be empty: ");
    checkEvent(event, this.getClass().getName(), "test1", "message " + count.get());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:51,代码来源:TestInferCaller.java

示例10: test4

import java.util.logging.Logger; //导入方法依赖的package包/类
public void test4(Logger logger) {
    System.out.println("test4: " + loggerName(logger));
    AtomicInteger count = new AtomicInteger();
    assertEquals(0, TestHandler.PUBLISHED.size(), "Queue should be empty: ");
    logger.setLevel(Level.ALL);
    assertEquals(0, TestHandler.PUBLISHED.size(), "Queue should be empty: ");

    logger.severe(() -> "message " + count.incrementAndGet());
    assertEquals(1, TestHandler.PUBLISHED.size(), "No event in queue: ");
    LogEvent event = TestHandler.PUBLISHED.remove();
    assertEquals(0, TestHandler.PUBLISHED.size(), "Queue should be empty: ");
    checkEvent(event, this.getClass().getName(), "test4", "message " + count.get());

    logger.warning(() -> "message " + count.incrementAndGet());
    assertEquals(1, TestHandler.PUBLISHED.size(), "No event in queue: ");
    event = TestHandler.PUBLISHED.remove();
    assertEquals(0, TestHandler.PUBLISHED.size(), "Queue should be empty: ");
    checkEvent(event, this.getClass().getName(), "test4", "message " + count.get());

    logger.info(() -> "message " + count.incrementAndGet());
    assertEquals(1, TestHandler.PUBLISHED.size(), "No event in queue: ");
    event = TestHandler.PUBLISHED.remove();
    assertEquals(0, TestHandler.PUBLISHED.size(), "Queue should be empty: ");
    checkEvent(event, this.getClass().getName(), "test4", "message " + count.get());

    logger.config(() -> "message " + count.incrementAndGet());
    assertEquals(1, TestHandler.PUBLISHED.size(), "No event in queue: ");
    event = TestHandler.PUBLISHED.remove();
    assertEquals(0, TestHandler.PUBLISHED.size(), "Queue should be empty: ");
    checkEvent(event, this.getClass().getName(), "test4", "message " + count.get());

    logger.fine(() -> "message " + count.incrementAndGet());
    assertEquals(1, TestHandler.PUBLISHED.size(), "No event in queue: ");
    event = TestHandler.PUBLISHED.remove();
    assertEquals(0, TestHandler.PUBLISHED.size(), "Queue should be empty: ");
    checkEvent(event, this.getClass().getName(), "test4", "message " + count.get());

    logger.finer(() -> "message " + count.incrementAndGet());
    assertEquals(1, TestHandler.PUBLISHED.size(), "No event in queue: ");
    event = TestHandler.PUBLISHED.remove();
    assertEquals(0, TestHandler.PUBLISHED.size(), "Queue should be empty: ");
    checkEvent(event, this.getClass().getName(), "test4", "message " + count.get());

    logger.finest(() -> "message " + count.incrementAndGet());
    assertEquals(1, TestHandler.PUBLISHED.size(), "No event in queue: ");
    event = TestHandler.PUBLISHED.remove();
    assertEquals(0, TestHandler.PUBLISHED.size(), "Queue should be empty: ");
    checkEvent(event, this.getClass().getName(), "test4", "message " + count.get());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:50,代码来源:TestInferCaller.java

示例11: randomInt

import java.util.logging.Logger; //导入方法依赖的package包/类
/**
 * Convenience to aid logging uses of Randoms.
 *
 * @param logger The {@code Logger} to log to.
 * @param logMe A string to log with the result.
 * @param random A pseudo-{@code Random} number source.
 * @param range The exclusive maximum integer to return.
 * @return A pseudo-random integer r, 0 &le; r &lt; range.
 */
public static int randomInt(Logger logger, String logMe, Random random,
                            int range) {
    int ret = random.nextInt(range);
    if (logger != null) {
        logger.finest(logMe + " random(" + range + ") = " + ret);
    }
    return ret;
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:18,代码来源:RandomUtils.java


注:本文中的java.util.logging.Logger.finest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。