本文整理汇总了Java中java.util.logging.Logger.finer方法的典型用法代码示例。如果您正苦于以下问题:Java Logger.finer方法的具体用法?Java Logger.finer怎么用?Java Logger.finer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.logging.Logger
的用法示例。
在下文中一共展示了Logger.finer方法的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: checkNameUsage
import java.util.logging.Logger; //导入方法依赖的package包/类
private static void checkNameUsage(Logger logger, String nameType, Map<String,Set<String>> names) {
if (names.isEmpty()) {
logger.info("no usage for " + nameType + " names");
return;
}
logger.info("usage for " + nameType + " names");
for (Map.Entry<String,Set<String>> e : names.entrySet()) {
String name = e.getKey();
Set<String> modules = e.getValue();
logger.finer(nameType + " " + name + ": " + Strings.join(modules, ", "));
if (modules.size() == 1) {
String modulePath = modules.iterator().next();
logger.warning(nameType + " " + name + " used only once by " + modulePath);
}
}
}
示例3: 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;
}
}
示例4: getQuery
import java.util.logging.Logger; //导入方法依赖的package包/类
public String getQuery(Logger logger) {
StringBuilder sb = new StringBuilder("SELECT ");
if (distinct) {
sb.append("DISTINCT ");
}
sb.append(select);
if (hasFrom()) {
sb.append(" FROM ");
sb.append(from);
}
if (hasWhere()) {
sb.append(" WHERE ");
sb.append(where);
}
String result = sb.toString();
if (logger != null) {
logger.finer(result);
}
return result;
}
示例5: processFile
import java.util.logging.Logger; //导入方法依赖的package包/类
private void processFile(ProcessingContext<Corpus> ctx, Corpus corpus, BufferedReader r) throws IOException {
Logger logger = getLogger(ctx);
String streamName = sourcePath.getStreamName(r);
logger.finer("reading: " + streamName);
String name = getBasename(streamName);
Map<String,List<String>> metadata = getMetadata(ctx, name);
StringBuilder sb = new StringBuilder();
int n = 0;
int l = 0;
for (String line = r.readLine(); line != null; line = r.readLine()) {
logger.finer("line.length = " + line.length());
for (int i = 0; i < line.length(); ++i) {
char c = line.charAt(i);
sb.append(c < 32 ? ' ' : c);
}
sb.append('\n');
++l;
if (((sizeLimit != null) && (sb.length() >= sizeLimit)) || ((linesLimit != null) && (l >= linesLimit))) {
createDocument(corpus, name + Integer.toString(n++), metadata, sb.toString());
sb.setLength(0);
l = 0;
}
}
logger.finer("done: " + streamName);
if (n == 0)
createDocument(corpus, name, metadata, sb.toString());
else
createDocument(corpus, name + Integer.toString(n), metadata, sb.toString());
}
示例6: process
import java.util.logging.Logger; //导入方法依赖的package包/类
@Override
public void process(ProcessingContext<Corpus> ctx, Corpus corpus) throws ModuleException {
Logger logger = getLogger(ctx);
EvaluationContext evalCtx = new EvaluationContext(logger);
D dict = createDictionary(ctx);
try {
Timer<TimerCategory> fillTimer = getTimer(ctx, "load-dictionary", TimerCategory.LOAD_RESOURCE, true);
fillDictionary(ctx, corpus, dict);
fillTimer.stop();
logger.finer("dictionary weight: " + dict.countKeys() + " keys, " + dict.keyLength() + " key length, " + dict.countValues() + " values, " + dict.countStates() + " states");
Matcher<T> matcher = new Matcher<T>(subject.isCharPos(), logger.isLoggable(Level.FINER), dict, subject.getStartFilter(), subject.getEndFilter());
logger.info("searching");
int n = 0;
for (Section sec : Iterators.loop(sectionIterator(evalCtx, corpus))) {
matcher.reset();
subject.match(sec, dict, matcher);
Layer targetLayer = sec.ensureLayer(targetLayerName );
for (Match<T> m : matcher.getMatches()) {
Annotation a = new Annotation(this, targetLayer, m.getStart(), m.getEnd());
for (T entry : m.getState().getValues())
handleEntryValues(ctx, dict, a, entry);
n++;
}
}
if (n == 0) {
logger.warning("found no matches");
}
else {
logger.info("found " + n + " matches");
}
logger.finer("match weight: " + matcher.getVisitedStatesCount() + " visited states");
}
catch (Exception e) {
rethrow(e);
}
}
示例7: processFile
import java.util.logging.Logger; //导入方法依赖的package包/类
private void processFile(ProcessingContext<Corpus> ctx, Logger logger, Corpus corpus, InputStream file, Transformer transformer) throws ModuleException, IOException {
try {
String name = sourcePath.getStreamName(file);
logger.finer("reading: " + name);
transformer.reset();
transformer.setParameter(SOURCE_PATH_PARAMETER, name);
transformer.setParameter(SOURCE_BASENAME_PARAMETER, new File(name).getName());
transformer.setParameter(XML_READER_CONTEXT_PARAMETER, new XMLReaderContext(this, corpus));
Source source = getSource(ctx, file);
doTransform(ctx, transformer, source);
}
catch (TransformerException|SAXException|ParserConfigurationException e) {
rethrow(e);
}
}
示例8: mergeAdjudications
import java.util.logging.Logger; //导入方法依赖的package包/类
void mergeAdjudications(Logger logger) {
List<AnnotationSet> headDependencies = getHeadDependencies();
if (headDependencies.size() != 2) {
throw new RuntimeException("not enough head dependencies");
}
logger.fine("updating annotation references");
updateReferences(headDependencies);
logger.fine("auto-adjudicating " + toString());
Iterator<AnnotationSet> asit = headDependencies.iterator();
AnnotationSet aset1 = asit.next();
AnnotationSet aset2 = asit.next();
Map<String,String> forwardSources = buildForwardSources();
logger.fine(" forward sources: " + forwardSources.size());
MergeLog mergeLog = new MergeLog(logger);
AnnotationMerger<TextBound> textBoundMerger = new TextBoundMerger(mergeLog, forwardSources);
textBoundMerger.merge(aset1, aset2, true);
mergeLog.report("text-bound");
AnnotationMerger<Relation> relationMerger = new RelationMerger(mergeLog, forwardSources);
AnnotationMerger<Group> groupMerger = new GroupMerger(mergeLog, forwardSources);
boolean firstPass = true;
while (true) {
mergeLog.reset();
boolean proceed = relationMerger.merge(aset1, aset2, firstPass);
mergeLog.report("relation");
mergeLog.reset();
proceed = proceed | groupMerger.merge(aset1, aset2, firstPass); // non short-circuit "or"
mergeLog.report("group");
if (proceed) {
logger.finer(" another round...");
firstPass = false;
}
else {
break;
}
}
Collection<String> unmatchedIds = buildUnmatchedIds();
aset1.logStillNeedAdjudication(logger, forwardSources, unmatchedIds);
aset2.logStillNeedAdjudication(logger, forwardSources, unmatchedIds);
mergeLog.reportByType();
}
示例9: logStillNeedAdjudication
import java.util.logging.Logger; //导入方法依赖的package包/类
private void logStillNeedAdjudication(Logger logger, Map<String,String> forwardSources, Collection<String> unmatchedIds) {
int n = 0;
logger.fine("still need to be adjudicated (" + user + "):");
for (AlvisAEAnnotation annot : annotations.values()) {
String id = annot.getId();
if (forwardSources.containsKey(id) || unmatchedIds.contains(id)) {
continue;
}
logger.finer(" " + annot);
n++;
}
logger.fine(" total: " + n);
}
示例10: 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());
}
示例11: 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());
}