Java Code Examples for java.util.logging.Logger.info()

The following are Jave code examples for showing how to use info() of the java.util.logging.Logger class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: incubator-netbeans   File: EarlyHandlerTest.java   Source Code and License Vote up 6 votes
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());
    }
}
 
Example 2
Project: alvisnlp   File: WekaTrain.java   Source Code and License Vote up 6 votes
@TimeThis(task="write-results", category=TimerCategory.EXPORT)
protected void writeCrossValidationResults(ProcessingContext<Corpus> ctx, TargetStream evaluationFile, Evaluation evaluation, String[] classes) throws Exception {
	Logger logger = getLogger(ctx);
       logger.info("writing test results into " + evaluationFile.getName());
       try (PrintStream out = evaluationFile.getPrintStream()) {
       	for (int i = 0; i < classes.length; ++i) {
       		out.printf("Results for class %d (%s):\n", i, classes[i]);
       		out.printf("  True positives : %8.0f\n", evaluation.numTruePositives(i));
       		out.printf("  False positives: %8.0f\n", evaluation.numFalsePositives(i));
       		out.printf("  True negatives : %8.0f\n", evaluation.numTrueNegatives(i));
       		out.printf("  False negatives: %8.0f\n", evaluation.numFalseNegatives(i));
       		out.printf("  Recall:    %6.4f\n", evaluation.recall(i));
       		out.printf("  Precision: %6.4f\n", evaluation.precision(i));
       		out.printf("  F-Measure: %6.4f\n", evaluation.fMeasure(i));
       		out.println();
       	}
       	out.println(evaluation.toMatrixString("Confusion matrix:"));
       }
}
 
Example 3
Project: alvisnlp   File: RDFProjector.java   Source Code and License Vote up 6 votes
@Override
protected void fillTrie(Logger logger, Trie<Resource> trie, Corpus corpus) throws IOException, ModuleException {
	Model model = createModel(logger);
	Property typeProp = model.getProperty("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
	Property[] labelPropertyProps = getProperties(model, labelURIs);
	int nEntries = 0;
	for (String resourceTypeURI : resourceTypeURIs) {
		Property resourceType = model.getProperty(model.expandPrefix(resourceTypeURI));
		for (Resource res : Iterators.loop(model.listSubjectsWithProperty(typeProp , resourceType))) {
			if (res.isAnon()) {
				continue;
			}
			for (Property prop : labelPropertyProps) {
				for (RDFNode node : Iterators.loop(model.listObjectsOfProperty(res, prop))) {
					String label = getNodeValue(node);
					trie.addEntry(label, res);
					nEntries++;
				}
			}
		}
	}
	logger.info("Entries: " + nEntries);
}
 
Example 4
Project: alvisnlp   File: QuickHTML.java   Source Code and License Vote up 6 votes
private void generateDocuments(Logger logger, EvaluationContext evalCtx, Corpus corpus, Set<String> classes, Document docList) throws XPathExpressionException, IOException, SAXException, TransformerFactoryConfigurationError {
	logger.info("generating HTML documents");
	Element docListUL = XMLUtils.evaluateElement(XPATH_DOCUMENT_LIST, docList);
	Document docSkel = createDocumentSkeleton();
	Iterator<fr.inra.maiage.bibliome.alvisnlp.core.corpus.Document> docIt = documentIterator(evalCtx, corpus);
	fr.inra.maiage.bibliome.alvisnlp.core.corpus.Document prev = null;
	fr.inra.maiage.bibliome.alvisnlp.core.corpus.Document next = docIt.hasNext() ? docIt.next() : null;
	while (next != null) {
		fr.inra.maiage.bibliome.alvisnlp.core.corpus.Document doc = next;
		addDocumentListItem(docList, docListUL, doc);
		next = docIt.hasNext() ? docIt.next() : null;
		Document xmlDoc = createDocument(docSkel, doc, prev, next);
		HTMLBuilderFragmentTagIterator frit = new HTMLBuilderFragmentTagIterator(this, classes);
		for (Section sec : Iterators.loop(sectionIterator(evalCtx, doc))) {
			createSection(xmlDoc, sec, frit);
		}
		writeXHTMLDocument(xmlDoc, doc.getId());
		prev = doc;
	}
}
 
Example 5
Project: alvisnlp   File: RegExp.java   Source Code and License Vote up 6 votes
@Override
public void process(ProcessingContext<Corpus> ctx, Corpus corpus) throws ModuleException {
	Logger logger = getLogger(ctx);
	EvaluationContext evalCtx = new EvaluationContext(logger);
   	int n = 0;
       for (Section sec : Iterators.loop(sectionIterator(evalCtx, corpus))) {
           Matcher matcher = getPattern().matcher(sec.getContents());
           Layer layer = sec.ensureLayer(getTargetLayerName());
           while (matcher.find()) {
           	n++;
               new Annotation(this, layer, matcher.start(), matcher.end());
           }
       }
       if (n == 0) {
       	logger.warning("found no matches");
       }
       else {
       	logger.info("found " + n + " matches");
       }
   }
 
Example 6
Project: alvisnlp   File: Run.java   Source Code and License Vote up 6 votes
public void process(PlanBuilder planBuilder) {
	ProcessingContext<Corpus> processingContext = getProcessingContext();
	Timer<TimerCategory> timer = processingContext.getTimer();
	timer.start();
	try {
		Logger logger = getLogger(processingContext);
		logger.info("result identifier: " + id);
		Sequence<Corpus> plan = planBuilder.buildPlan(this);
		planBuilder.setParams(this, plan);
		planBuilder.check(plan);
		addStatus(RunStatus.STARTED, "", false);
		plan.init(processingContext);
		processingContext.processCorpus(plan, new Corpus());
		addStatus(RunStatus.SUCCESS, "", true);
	}
	catch (Exception e) {
		addStatus(RunStatus.FAILURE, "", true);
	}
       finally {
       	timer.stop();
       }
}
 
Example 7
Project: MCGameInfoPlugin   File: Util.java   Source Code and License Vote up 6 votes
public static void loadGamePatterns(List<Map> source, Set<GamePattern> gamePatterns, Logger logger) {
	gamePatterns.clear();
	for (Map map : source) {
		if (!map.containsKey("pattern")) {
			logger.warning("Missing 'pattern' key");
			continue;
		}
		if (!map.containsKey("game")) {
			logger.warning("Missing 'game' key");
			continue;
		}

		GamePattern pattern = new GamePattern((String) map.get("pattern"), (String) map.get("game"));
		gamePatterns.add(pattern);
		logger.info(pattern.getPattern().pattern() + " -> " + pattern.getGame());
	}
}
 
Example 8
Project: 201710-paseos_01   File: FotosTestIntegracion.java   Source Code and License Vote up 6 votes
@Test 
public void postman(){

    try {              
        Process process = Runtime.getRuntime().exec("/paseos-01-prueba-fotos");
        InputStream inputStream = process.getInputStream();
        BufferedReader bf= new BufferedReader(new InputStreamReader(inputStream));
        String line="";
        String ln;
        Logger log=Logger.getAnonymousLogger();
        
        while ((ln=bf.readLine()) != null) {
           log.info(ln);
            line=line.concat(ln);
        }
            
        inputStream.close();
        bf.close();
    } catch (IOException ioe) {
        ioe.printStackTrace();
    }
}
 
Example 9
Project: MegaSparkDiff   File: MemoryDbHsqlTest.java   Source Code and License Vote up 6 votes
@Test
public void testInitialization()
{
    MemoryDbHsql.getInstance().initializeMemoryDB();

    if (MemoryDbHsql.getInstance().getState() != 1)
    {
        Assert.fail("server was not running");
    }

    MemoryDbHsql.getInstance().shutdownMemoryDb();
    int state = MemoryDbHsql.getInstance().getState();
    if (state != 16)
    {
        Logger log = Logger.getLogger(this.getClass().getName());
        log.info("Memory HQL DB state was " + state);
        Assert.fail("server was running although asked to stop it");
    }
}
 
Example 10
Project: alvisnlp   File: RemoveContents.java   Source Code and License Vote up 5 votes
private static void removeOldSections(Logger logger, Map<Element,Element> map) {
	int n = 0;
	for (Map.Entry<Element,Element> e : map.entrySet()) {
		Section oldSec = DownCastElement.toSection(e.getKey());
		if (oldSec != null) {
			Document oldDoc = oldSec.getDocument();
			oldDoc.removeSection(oldSec);
			n++;
		}
	}
	logger.info("removed " + n + " sections");
}
 
Example 11
Project: alvisnlp   File: AlvisNLP.java   Source Code and License Vote up 5 votes
@Override
protected void logFinished(Logger logger, Corpus corpus) {
	if (!noProcess) {
		logger.info("annotations: " + corpus.countAnnotations());
		logger.info("postings: " + corpus.countPostings());
	}
}
 
Example 12
Project: bibliome-java-utils   File: NCBITaxonomy.java   Source Code and License Vote up 5 votes
/**
 * Reads a NCBI nodes.dmp file.
 * @param logger
 * @param file
 * @param size
 * @throws IOException
 * @throws InvalidFileLineEntry
 */
public void readNodes(Logger logger, File file, int size) throws IOException, InvalidFileLineEntry {
	logger.info("reading nodes file: " + file.getCanonicalPath());
	NodesFileLines fl = new NodesFileLines();
	fl.setLogger(logger);
	int[] parent = new int[size];
	fl.process(file, DmpFileLines.CHARSET, parent);
	for (Taxon taxon : taxa.values()) {
		int taxid = taxon.getTaxid();
		int parentId = parent[taxid];
		taxon.setParent(taxa.get(taxid == parentId ? null : parentId));
	}
}
 
Example 13
Project: alvisnlp   File: AlvisNLP.java   Source Code and License Vote up 5 votes
@Override
  protected Corpus getCorpus(Logger logger) throws IOException {
Corpus result = createCorpus(logger);
      for (Pair<String,String> f : corpusFeatures) {
      	logger.info("setting corpus feature " + f.first + " = " + f.second);
      	result.addFeature(f.first, f.second);
      }
      return result;
  }
 
Example 14
Project: alvisnlp   File: Projector.java   Source Code and License Vote up 5 votes
@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);
	}
}
 
Example 15
Project: sample-acmegifts   File: NotificationFallbackHandler.java   Source Code and License Vote up 5 votes
@Override
public String handle(ExecutionContext context) {
  Object[] tweetParameters = context.getParameters();
  String message = (String) tweetParameters[0];
  Logger fbLogger = (Logger) tweetParameters[2];
  fbLogger.info(message);
  return null;
}
 
Example 16
Project: alvisnlp   File: AbstractAlvisNLP.java   Source Code and License Vote up 5 votes
private static <T> void logTimes(Logger logger, String title, Stats<T,Count> stats) {
	logger.info(title);
	long total = stats.sum();
	for (Map.Entry<T,Count> e : stats.entryList(true)) {
		long t = e.getValue().get();
		logger.info(String.format("% 8d   %6.2f%%   %s", t / 1000000, 100.0 * t / total, e.getKey()));
	}
}
 
Example 17
Project: openjdk-jdk10   File: TestInferCaller.java   Source Code and License Vote up 4 votes
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());
}
 
Example 18
Project: Pogamut3   File: PogamutRelease.java   Source Code and License Vote up 4 votes
public static void main(String[] args) {
	
	// FOR TESTING ONLY!
	//args = new String[] { "D:/Workspaces/Pogamut-Trunk/Main/PogamutRelease/release-all/config/PogamutRelease-step00-DeployOldSnapshots-Libs.xml", "-c" };
	
	if (args == null) {
		args = new String[1];
		args[0] = "PogamutRelease.xml";
	} else
	if (args.length == 0) {
		args = new String[1];
		args[0] = "PogamutRelease.xml";
	} 		
	
	SimpleLogging.initLogging(true);
	SimpleLogging.addFileLogging("PogamutRelease.log");
	
	Logger log = Logger.getAnonymousLogger();
	log.info("---[[ POGAMUT RELEASE ]]---");
	
	boolean continueTheBuild = false;
	for (String arg : args) {
		if (arg != null && (arg.equals("-c") ||arg.equals("--continue"))) {
			continueTheBuild = true;
			log.info("CONTINUING THE WORK!");
			break;
		}
	}
	
	int i = 0;
	for (String definition : args) {
		if (definition != null && (definition.equals("-c") || definition.equals("--continue"))) {
			continue;
		}
		++i;
		log.info("======================================");
		log.info("DEFINITION " + i + " / " + (args.length - (continueTheBuild ? 1 : 0)));
		log.info("Loading definition from xml file: " + definition + " --> " + new File(definition).getAbsoluteFile());
		log.info("======================================");			
		log.info("");
		File file = new File(definition);
		if (!file.exists() || !file.isFile()) {
			log.severe("FAILED! Definition file not found at: " + file.getAbsolutePath());
			log.severe("Usage: java -jar PogamutRelease.jar [path-to-definition-xml-file] [-c | --continue]");
			log.info("---[[ FAIL ]]---");
			System.exit(1);
			return;
		}
		PogamutRelease release;
		try {
			release = new PogamutRelease(file, continueTheBuild);
		} catch (Exception e) {
			e.printStackTrace();
			log.severe("Usage: java -jar PogamutRelease.jar [path-to-definition-xml-file-1] [path-to-definition-xml-file-2] [...] [-c | --continue]");
			log.info("---[[ FAIL ]]---");
			return;
		}
		release.setLog(log);
		log.info("Definition file loaded.");
		if (!release.run()) {
			log.info("---[[ FAIL ]]---");
			System.exit(1);
			return;
		}
	}
	
	log.info("---[[ OK ]]---");
	System.exit(0);
}
 
Example 19
Project: alvisnlp   File: HelloWorld.java   Source Code and License Vote up 4 votes
@Override
public void process(ProcessingContext<Corpus> ctx, Corpus corpus) throws ModuleException {
	Logger logger = getLogger(ctx);
	logger.info("hello world!");
}
 
Example 20
Project: catalog-search-service   File: MediatorWebservice.java   Source Code and License Vote up 4 votes
private String queryqueryGetResultAsCSVHelper(IQuerySolution solution, Logger barlogger, String query) {
	String result = "";
	String zwi = "";
	if (solution != null) {
		QuerySolutionModel tmp = new QuerySolutionModel(solution);
		StringReader sr = new StringReader(query);
		SimpleQueryParser sqp = new SimpleQueryParser(sr);
		OutputQuery out = null;
		try {
			IQuery q = sqp.parse(true, false);
			if (!q.isIntputQuery())
				out = ((OutputQuery) q);
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			barlogger.severe(e.toString());
		}

		String[][] data = new String[tmp.getRowCount()][tmp.getColumnCount()];
		String[] columns = new String[tmp.getColumnCount()];
		barlogger.info("Ergebnis der Anfrage: " + tmp.getRowCount());
		// An dieser Stelle filtere ich die doppelten Eintr├Ąge raus
		List<Integer> allForbidenRows = detectDuplicates(tmp);
		for (int a = 0; a < tmp.getRowCount(); a++) {

			if (allForbidenRows.contains(a)) {
				continue;
			}
			for (int i = 0; i < tmp.getColumnCount(); i++) {
				columns[i] = tmp.getColumnName(i) + ";";
				if (out != null) {
					for (SimpleConstraint con : out.getConstraint().flatToSimpleConstraints()) {
						if (con.getResultVars().contains(tmp.getColumnName(i))) {
							columns[i] = tmp.getColumnName(i) + ":" + con.getPredicate();

						}
					}
				}

				data[a][i] = (String) tmp.getValueAt(a, i).toString();
				if (a > 0) {
					zwi += (String) tmp.getValueAt(a, i).toString() + ";";
				}

			}
			if (a > 0) {
				if (zwi.charAt(zwi.length() - 1) == ';') {
					zwi = zwi.substring(0, zwi.length() - 1);
				}

				zwi += "\n";
			}
		}
		for (int i = 0; i < columns.length; i++) {
			result += columns[i];
		}

	}
	result += "\n" + zwi;

	barlogger.info(result);
	return result;
}