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

The following are Jave code examples for showing how to use fine() 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.
+ Save this method
Example 1
Project: jdk8u-jdk   File: TestLogConfigurationDeadLockWithConf.java   View Source Code Vote up 6 votes
@Override
public void run() {
    try {
        while (goOn) {
            Logger l;
            int barcount = getBarCount();
            for (int i=0; i < LCOUNT ; i++) {
                l = Logger.getLogger("foo.bar"+barcount+".l"+nextLogger.incrementAndGet());
                l.fine("I'm fine");
                if (!goOn) break;
                Thread.sleep(1);
            }
        }
    } catch (InterruptedException | RuntimeException x ) {
        fail(x);
    }
}
 
Example 2
Project: openjdk-jdk10   File: ServiceLoaderUtil.java   View Source Code Vote up 6 votes
static Object lookupUsingOSGiServiceLoader(String factoryId, Logger logger) {

        try {
            // Use reflection to avoid having any dependendcy on ServiceLoader class
            Class serviceClass = Class.forName(factoryId);
            Class target = Class.forName(OSGI_SERVICE_LOADER_CLASS_NAME);
            Method m = target.getMethod(OSGI_SERVICE_LOADER_METHOD_NAME, Class.class);
            Iterator iter = ((Iterable) m.invoke(null, serviceClass)).iterator();
            if (iter.hasNext()) {
                Object next = iter.next();
                logger.fine("Found implementation using OSGi facility; returning object [" +
                        next.getClass().getName() + "].");
                return next;
            } else {
                return null;
            }
        } catch (IllegalAccessException |
                InvocationTargetException |
                ClassNotFoundException |
                NoSuchMethodException ignored) {

            logger.log(Level.FINE, "Unable to find from OSGi: [" + factoryId + "]", ignored);
            return null;
        }
    }
 
Example 3
Project: store-app-ee   File: LoggingInterceptor.java   View Source Code Vote up 6 votes
@AroundInvoke
public Object interceptMethodInvocation(InvocationContext invocationContext) throws Exception {

    final String methodName = invocationContext.getMethod().getName();
    final String className = invocationContext.getTarget().getClass().getName();

    Logger logger = Logger.getLogger(className);

    final long timeBeforeMethodInvocation;
    final long timeAfterMethodInvocation;
    final long millis;
    logger.entering(className, methodName);
    timeBeforeMethodInvocation = System.currentTimeMillis();

    try {
        return invocationContext.proceed();
    } finally {
        timeAfterMethodInvocation = System.currentTimeMillis();
        millis = timeAfterMethodInvocation - timeBeforeMethodInvocation;
        logger.fine("Method took -> " + millis + " millis to be executed!");
        logger.exiting(className, methodName);
    }
}
 
Example 4
Project: rapidminer   File: SimpleUnitExecutor.java   View Source Code Vote up 6 votes
@Override
public void execute(ExecutionUnit unit) throws OperatorException {
	Logger logger = unit.getEnclosingOperator().getLogger();
	if (logger.isLoggable(Level.FINE)) {
		logger.fine("Executing subprocess " + unit.getEnclosingOperator().getName() + "." + unit.getName()
				+ ". Execution order is: " + unit.getOperators());
	}
	Enumeration<Operator> opEnum = unit.getOperatorEnumeration();
	while (opEnum.hasMoreElements()) {
		// for (Operator operator : unit.getOperators()) {
		Operator operator = opEnum.nextElement();
		operator.execute();
		operator.freeMemory();
	}

}
 
Example 5
Project: alvisnlp   File: GeniaTagger.java   View Source Code Vote up 6 votes
@Override
public void processOutput(BufferedReader out, BufferedReader err) throws ModuleException {
	try {
		Logger logger = getLogger(ctx);
		logger.fine("geniatagger standard error:");
		while (true) {
			String line = err.readLine();
			if (line == null)
				break;
			logger.fine("    " + line);
		}
		logger.fine("end of geniatagger standard error");
	}
	catch (FileNotFoundException fnfe) {
		rethrow(fnfe);
	}
	catch (IOException ioe) {
		rethrow(ioe);
	}
}
 
Example 6
Project: alvisnlp   File: TreeTaggerExternal.java   View Source Code Vote up 6 votes
@Override
  public void processOutput(BufferedReader out, BufferedReader err) throws ModuleException {
      if (silent) {
	return;
}
      Logger logger = owner.getLogger(ctx);
      try {
          logger.fine("tree-tagger standard error:");
          for (String line = err.readLine(); line != null; line = err.readLine()) {
              logger.fine("    " + line);
          }
          logger.fine("end of tree-tagger standard error");
      }
      catch (IOException ioe) {
          logger.warning("could not read tree-tagger standard error: " + ioe.getMessage());
      }
  }
 
Example 7
Project: openjdk-jdk10   File: TestConfigurationLock.java   View Source Code Vote up 6 votes
@Override
public void run() {
    while (goOn) {
        try {
            if (Math.random() > CONFSYNCTHRESHOLD) {
                // calling reset while holding a lock can increase
                // deadlock probability...
                synchronized(fakeConfExternalLock()) {
                    LogManager.getLogManager().reset();
                }
            } else {
                LogManager.getLogManager().reset();
            }
            Logger blah = Logger.getLogger(BLAH);
            blah.setLevel(Level.FINEST);
            blah.fine(BLAH);
            resetCount.incrementAndGet();
            pause(1);
        } catch (Exception x) {
            fail(x);
        }
    }
}
 
Example 8
Project: openjdk-jdk10   File: TestIsLoggable.java   View Source Code Vote up 6 votes
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;
    }
}
 
Example 9
Project: alvisnlp   File: AbstractYateaExtractor.java   View Source Code Vote up 6 votes
@Override
public void processOutput(BufferedReader out, BufferedReader err) {
    try {
        Logger logger = getLogger(ctx);
        logger.fine("yatea standard error:");
        for (String line = err.readLine(); line != null; line = err.readLine()) {
        	if (line.startsWith("CHERCHE")) {
        		continue;
        	}
        	if (line.startsWith("Unparsed phrases...")) {
        		continue;
        	}
            logger.fine("    " + line);
        }
        logger.fine("end of yatea standard error");
    }
    catch (IOException ioe) {
        getLogger(ctx).warning("could not read yatea standard error: " + ioe.getMessage());
    }
}
 
Example 10
Project: openjdk-jdk10   File: TestConfigurationLock.java   View Source Code Vote up 6 votes
@Override
public void run() {
    try {
        while (goOn) {
            Logger l;
            Logger foo = Logger.getLogger("foo");
            Logger bar = Logger.getLogger("foo.bar");
            for (int i=0; i < LCOUNT ; i++) {
                LogManager manager = LogManager.getLogManager();
                if (Math.random() > LOGSYNCTHRESHOLD) {
                    synchronized(fakeLogExternalLock()) {
                        l = Logger.getLogger("foo.bar.l"+nextLogger.incrementAndGet());
                    }
                } else {
                    l = Logger.getLogger("foo.bar.l"+nextLogger.incrementAndGet());
                }
                l.setLevel(Level.FINEST);
                l.fine("I'm fine");
                if (!goOn) break;
                pause(1);
            }
        }
    } catch (InterruptedException | RuntimeException x ) {
        fail(x);
    }
}
 
Example 11
Project: openjdk-jdk10   File: TestLogConfigurationDeadLockWithConf.java   View Source Code Vote up 6 votes
@Override
public void run() {
    try {
        while (goOn) {
            Logger l;
            int barcount = getBarCount();
            for (int i=0; i < LCOUNT ; i++) {
                l = Logger.getLogger("foo.bar"+barcount+".l"+nextLogger.incrementAndGet());
                l.fine("I'm fine");
                if (!goOn) break;
                Thread.sleep(1);
            }
        }
    } catch (InterruptedException | RuntimeException x ) {
        fail(x);
    }
}
 
Example 12
Project: incubator-netbeans   File: ViewUtils.java   View Source Code Vote up 5 votes
/**
 * Log msg with FINE level or dump a stack if the logger has FINEST level.
 *
 * @param logger
 * @param msg message to log
 */
public static void log(Logger logger, String msg) {
    if (logger.isLoggable(Level.FINEST)) {
        logger.log(Level.INFO, "Cause of " + msg, new Exception());
    } else {
        logger.fine(msg);
    }
}
 
Example 13
Project: bibliome-java-utils   File: AnnotationSet.java   View Source Code Vote up 5 votes
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();
}
 
Example 14
Project: rapidminer   File: MidasUnitExecutor.java   View Source Code Vote up 5 votes
@Override
public void execute(ExecutionUnit unit) throws OperatorException {
  Logger logger = unit.getEnclosingOperator().getLogger();
  if (logger.isLoggable(Level.FINE)) {
    logger.fine("Executing subprocess " + unit.getEnclosingOperator().getName() + "." + unit.getName()
            + ". Execution order is: " + unit.getOperators());
  }

  if (remote.isRemote(unit)) {
    boolean runnable = validateRemote(unit, ValidationMode.STRICT());
    if (runnable) {
      JobStatus status = remote.execute(unit);
      RemoteResultDisplay display = RapidMinerGUI.getMainFrame().getRemoteResultDisplay();
      boolean shouldSwitchPerspective = !OperatorService.isRapidGUITestMode();
      display.addJobStatus(status, shouldSwitchPerspective);
      final RemoteResultOverview overview = display.getOverview();

      // Scroll the view.
      SwingUtilities.invokeLater(new Runnable() {

        @Override
        public void run() {
          Rectangle visibleRect = overview.getVisibleRect();
          visibleRect.y = overview.getHeight() - visibleRect.height;
          overview.scrollRectToVisible(visibleRect);
        }
      });
    }
  } else if (remote.isLocal(unit)) {
      // fallback to simple local mode
      simple.execute(unit);
  } else {
    // mix of remote and local, can't execute now
    throw new RuntimeException("can not mix remote operator with local one");
  }
}
 
Example 15
Project: bibliome-java-utils   File: AnnotationSet.java   View Source Code Vote up 5 votes
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);
}
 
Example 16
Project: alvisnlp   File: CCGParser.java   View Source Code Vote up 5 votes
@Override
public void processOutput(BufferedReader out, BufferedReader err) throws ModuleException {
	Logger logger = getLogger(ctx);
	try {
		logger.fine("CCG standard error:");
		for (String line = err.readLine(); line != null; line = err.readLine()) {
			logger.fine("    " + line);
		}
		logger.fine("end of CCG standard error");
	}
	catch (IOException ioe) {
		logger.warning("could not read CCG standard error: " + ioe.getMessage());
	}
}
 
Example 17
Project: alvisnlp   File: Mapper.java   View Source Code Vote up 4 votes
@Override
public void process(ProcessingContext<Corpus> ctx, Corpus corpus) throws ModuleException {
   	MapperResolvedObjects resObj = getResolvedObjects();
   	Logger logger = getLogger(ctx);
	EvaluationContext evalCtx = new EvaluationContext(logger);
   	Timer<TimerCategory> dictTimer = getTimer(ctx, "load-dictionary", TimerCategory.LOAD_RESOURCE, true);
   	DefaultMap<String,List<T>> mapping = new DefaultArrayListHashMap<String,T>();
   	fillMapping(mapping, ctx, corpus);
   	dictTimer.stop();
   	int n = 0;
   	int m = 0;
   	Timer<TimerCategory> mapTimer = getTimer(ctx, "map", TimerCategory.MODULE, false);
   	Timer<TimerCategory> handleTimer = getTimer(ctx, "handle", TimerCategory.MODULE, false);    	
   	for (Element elt : Iterators.loop(resObj.target.evaluateElements(evalCtx, corpus))) {
   		++n;
   		mapTimer.start();
   		String candidateKey = resObj.form.evaluateString(evalCtx, elt);
   		if (ignoreCase)
   			candidateKey = candidateKey.toLowerCase();
   		List<T> values = operator.getMatches(mapping, candidateKey);
   		mapTimer.stop();
   		if (values.isEmpty()) {
   			continue;
   		}
   		++m;
   		handleTimer.start();
   		for (T v : values) {
   			handleMatch(elt, v);
   		}
   		handleTimer.stop();
   	}
       if (n == 0) {
       	logger.warning("no annotations visited");
       }
       else if (m == 0) {
       	logger.warning(String.format("no annotations mapped (%d visited)", n));
       }
       else {
       	logger.fine(String.format("mapped %d/%d annotations", m, n));
       }
   }
 
Example 18
Project: rapidminer   File: DatabaseHandler.java   View Source Code Vote up 4 votes
public ResultSet executeStatement(String sql, boolean isQuery, Operator parameterHandler, Logger logger) throws SQLException, OperatorException {
    checkDatabaseConstraintOnOperator(parameterHandler, this.databaseURL);
    ResultSet resultSet = null;
    Object statement = null;

    try {
        if(parameterHandler.getParameterAsBoolean("prepare_statement")) {
            PreparedStatement prepared = this.getConnection().prepareStatement(sql);
            String[] parameters = ParameterTypeEnumeration.transformString2Enumeration(parameterHandler.getParameterAsString("parameters"));

            for(int i = 0; i < parameters.length; ++i) {
                String[] argDescription = ParameterTypeTupel.transformString2Tupel(parameters[i]);
                String sqlType = argDescription[0];
                String replacementValue = argDescription[1];
                if("VARCHAR".equals(sqlType)) {
                    prepared.setString(i + 1, replacementValue);
                } else if("REAL".equals(sqlType)) {
                    try {
                        prepared.setDouble(i + 1, Double.parseDouble(replacementValue));
                    } catch (NumberFormatException var21) {
                        prepared.close();
                        throw new UserError(parameterHandler, 158, new Object[]{replacementValue, sqlType});
                    }
                } else if("LONG".equals(sqlType)) {
                    try {
                        prepared.setLong(i + 1, Long.parseLong(replacementValue));
                    } catch (NumberFormatException var20) {
                        prepared.close();
                        throw new UserError(parameterHandler, 158, new Object[]{replacementValue, sqlType});
                    }
                } else {
                    if(!"INTEGER".equals(sqlType)) {
                        prepared.close();
                        throw new OperatorException("Illegal data type: " + sqlType);
                    }

                    try {
                        prepared.setInt(i + 1, Integer.parseInt(replacementValue));
                    } catch (NumberFormatException var19) {
                        prepared.close();
                        throw new UserError(parameterHandler, 158, new Object[]{replacementValue, sqlType});
                    }
                }
            }

            if(isQuery) {
                resultSet = this.executeQuery(prepared, parameterHandler);
            } else {
                this.execute(prepared, parameterHandler);
            }

            statement = prepared;
        } else {
            logger.info("Executing query: \'" + sql + "\'");
            statement = this.createStatement(false);
            if(isQuery) {
                resultSet = this.executeQuery((Statement)statement, parameterHandler, sql);
            } else {
                this.execute((Statement)statement, parameterHandler, sql);
            }
        }
    } finally {
        logger.fine("Query executed.");
        if(!isQuery && statement != null) {
            ((Statement)statement).close();
        }

    }

    return resultSet;
}
 
Example 19
Project: openjdk-jdk10   File: TestInferCaller.java   View Source Code 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 20
Project: openjdk-jdk10   File: ClassLoaderLeakTest.java   View Source Code Vote up 4 votes
public void launch(CountDownLatch done) {
    Logger log = Logger.getLogger("app_test_logger");
    log.fine("Test app is launched");

    done.countDown();
}