當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。