Package java.util.logging

Examples of java.util.logging.LogManager.readConfiguration()


      manager.reset();
      checkPropertyNull(manager);
      assertEquals(0, root.getHandlers().length);
      assertEquals(Level.INFO, root.getLevel());
      try {
        manager.readConfiguration();
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  }
View Full Code Here


      checkPropertyNull(manager);
      assertEquals(1, root.getHandlers().length);
      assertEquals(Level.OFF, root.getLevel());

      try {
        manager.readConfiguration();
      } catch (Exception e) {
        e.printStackTrace();
      }
      checkPropertyNull(manager);
      assertEquals(1, root.getHandlers().length);
View Full Code Here

      checkPropertyNull(manager);
      assertEquals(1, root.getHandlers().length);
      assertEquals(Level.OFF, root.getLevel());

      try {
        manager.readConfiguration();
      } catch (Exception e) {
        e.printStackTrace();
      }
      checkPropertyNull(manager);
      assertEquals(1, root.getHandlers().length);
View Full Code Here

      manager.reset();
      checkPropertyNull(manager);
      assertEquals(0, root.getHandlers().length);
      assertEquals(Level.INFO, root.getLevel());
      try {
        manager.readConfiguration();
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  }
View Full Code Here

      p.put(".level", "OFF");
      InputStream in = null;
      try {
        in = EnvironmentHelper.PropertiesToInputStream(p);
        LogManager manager = LogManager.getLogManager();
        manager.readConfiguration(in);
      } catch (Exception e) {
        e.printStackTrace();
      } finally {
        try {
          in.close();
View Full Code Here

     * test initHandler
     */
    public void test_initHandler() throws Exception {
        File logProps = new File(LOGGING_CONFIG_FILE);
        LogManager lm = LogManager.getLogManager();
        lm.readConfiguration(new FileInputStream(logProps));

        Logger log = Logger.getLogger("");
        // can log properly
        Handler[] handlers = log.getHandlers();
        assertEquals(2, handlers.length);
View Full Code Here

      // Try the current class loader if system one cannot find the file
      if (ins == null) {
      ins = this.getClass().getClassLoader().getResourceAsStream(loggerPropertiesFileName);
      }
      if (ins != null) {
      logManager.readConfiguration(ins);
      } else {
      System.out.println("WARNING: failed to load "+loggerPropertiesFileName);
      }
    } catch (SecurityException e) {
      handleException(e);
View Full Code Here

  }
 
  public static void main(String[] args) {
    LogManager lm=LogManager.getLogManager();
    try {
      lm.readConfiguration(Thread.currentThread().getContextClassLoader().getResourceAsStream("log.properties"));
    } catch (IOException ex) {
      System.err.println("failed to configure logging");
    }
    log.info("Starting...");
    Trackbase tb=new Trackbase();
View Full Code Here

      // Try the current class loader if system one cannot find the file
      if (ins == null) {
      ins = this.getClass().getClassLoader().getResourceAsStream(loggerPropertiesFileName);
      }
      if (ins != null) {
      logManager.readConfiguration(ins);
      } else {
      System.out.println("WARNING: failed to load "+loggerPropertiesFileName);
      }
    } catch (SecurityException e) {
      handleException(e);
View Full Code Here

            if (haveLoadedOurDefault || isDefaultJdkConfig()) {
                haveLoadedOurDefault = true;
                consoleHandler.setFormatter(
                        new BasicTextJdkLogFormatter(false));
                consoleHandler.setLevel(Level.INFO);
                lm.readConfiguration(
                        FrameworkLogger.class.getResourceAsStream(
                        "/org/hsqldb/resources/jdklogging-default.properties"));
                Logger cmdlineLogger = Logger.getLogger("org.hsqldb.cmdline");
                cmdlineLogger.addHandler(consoleHandler);
                cmdlineLogger.setUseParentHandlers(false);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.