當前位置: 首頁>>代碼示例>>Java>>正文


Java Logger.config方法代碼示例

本文整理匯總了Java中java.util.logging.Logger.config方法的典型用法代碼示例。如果您正苦於以下問題:Java Logger.config方法的具體用法?Java Logger.config怎麽用?Java Logger.config使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.util.logging.Logger的用法示例。


在下文中一共展示了Logger.config方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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

示例2: buildRootTempDir

import java.util.logging.Logger; //導入方法依賴的package包/類
private File buildRootTempDir(Logger logger) throws IOException {
tmpDir.mkdirs();
       File result = File.createTempFile("alvisnlp", "", tmpDir);
       result.delete();
       result.mkdirs();
       logger.config("temporary directory: " + result.getCanonicalPath());
       return result;
   }
 
開發者ID:Bibliome,項目名稱:alvisnlp,代碼行數:9,代碼來源:AbstractAlvisNLP.java

示例3: setValue

import java.util.logging.Logger; //導入方法依賴的package包/類
@Override
public void setValue(Logger logger, PlanLoader<A> planLoader, Module<A> module) throws ParameterException, ConverterException, UnsupportedServiceException {
  		ParamHandler<A> h = module.getParamHandler(name);
	ParamConverter conv = converterFactory.getService(h.getType());
	conv.setInputDirs(inputDirs);
	conv.setOutputDir(outputDir);
	conv.setResourceBases(buildResourceBases());
	logger.config("setting " + h.getName() + " to '" + value + "' in " + module.getPath());
	h.setValue(conv.convert(value));
}
 
開發者ID:Bibliome,項目名稱:alvisnlp,代碼行數:11,代碼來源:AbstractAlvisNLP.java

示例4: logEnvironment

import java.util.logging.Logger; //導入方法依賴的package包/類
private static void logEnvironment(Logger logger) {
	ResourceBundle res = ResourceBundle.getBundle("fr.inra.maiage.bibliome.alvisnlp.core.app.cli.LogEnvironment");
	for (String var : res.keySet()) {
		String value = System.getenv(var);
		if (value == null)
			continue;
		String label = res.getString(var);
		logger.config(label + ": " + value);
	}
}
 
開發者ID:Bibliome,項目名稱:alvisnlp,代碼行數:11,代碼來源:AbstractAlvisNLP.java

示例5: setupLoggers

import java.util.logging.Logger; //導入方法依賴的package包/類
/**
 * Sets up loggers to print to stdout (rather than stderr) and log to ~/Shuffleboard/shuffleboard.log
 */
private void setupLoggers() throws IOException {
  //Set up the global level logger. This handles IO for all loggers.
  final Logger globalLogger = LogManager.getLogManager().getLogger("");

  // Remove the default handlers that stream to System.err
  for (Handler handler : globalLogger.getHandlers()) {
    globalLogger.removeHandler(handler);
  }

  final Handler fileHandler = new FileHandler(Storage.getStorageDir() + "/shuffleboard.log");

  fileHandler.setLevel(Level.INFO);    // Only log INFO and above to disk
  globalLogger.setLevel(Level.CONFIG); // Log CONFIG and higher

  // We need to stream to System.out instead of System.err
  final StreamHandler sh = new StreamHandler(System.out, new SimpleFormatter()) {
    @Override
    public synchronized void publish(final LogRecord record) { // NOPMD this is the same signature as the superclass
      super.publish(record);
      // For some reason this doesn't happen automatically.
      // This will ensure we get all of the logs printed to the console immediately instead of at shutdown
      flush();
    }
  };
  sh.setLevel(Level.CONFIG); // Log CONFIG and higher to stdout

  globalLogger.addHandler(sh);
  globalLogger.addHandler(fileHandler);
  fileHandler.setFormatter(new SimpleFormatter()); //log in text, not xml

  globalLogger.config("Configuration done."); //Log that we are done setting up the logger
  globalLogger.config("Shuffleboard app version: " + Shuffleboard.class.getPackage().getImplementationVersion());
}
 
開發者ID:wpilibsuite,項目名稱:shuffleboard,代碼行數:37,代碼來源:Shuffleboard.java

示例6: activated

import java.util.logging.Logger; //導入方法依賴的package包/類
public void activated(Logger uiLogger) {
    uiLogger.config("A started");
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:4,代碼來源:ActivatedDeativatedTest.java

示例7: deactivated

import java.util.logging.Logger; //導入方法依賴的package包/類
public void deactivated(Logger uiLogger) {
    uiLogger.config("D stopped");
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:4,代碼來源:ActivatedDeativatedTest.java

示例8: 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

示例9: 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

示例10: loadDocument

import java.util.logging.Logger; //導入方法依賴的package包/類
/**
 * Reads plan description in the specified DOM tree and builds the corresponding module.
 * @param source
 * @return the sequence described in the specified DOM tree
 * @throws PlanException
 * @throws ConverterException 
 * @throws ServiceException 
 * @throws ParameterException 
 * @throws IOException 
 * @throws SAXException 
 * @throws URISyntaxException 
 */
public Sequence<T> loadDocument(Logger logger, String source, Document doc) throws PlanException, ModuleException, ServiceException, ConverterException, SAXException, IOException, URISyntaxException {
	logger.config("loading plan from " + source);
	Element elt = doc.getDocumentElement();
	if (!PLAN_ELEMENT_NAME.equals(elt.getTagName()))
		throw new PlanException("expected element " + PLAN_ELEMENT_NAME + ", got " + elt.getTagName());
	Sequence<T> result = loadSequence(logger, doc.getDocumentElement(), true);
	logger.fine("finished loading " + source);
	return result;
}
 
開發者ID:Bibliome,項目名稱:alvisnlp,代碼行數:22,代碼來源:PlanLoader.java


注:本文中的java.util.logging.Logger.config方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。