本文整理汇总了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());
}
}
示例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;
}
}
示例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);
}
}
示例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;
}
示例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 ≤ r < 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;
}
示例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 ≤ r < 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;
}
示例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 ≤ r < 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;
}
示例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);
}
示例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());
}
示例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());
}
示例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 ≤ r < 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;
}