Package java.util.logging

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


        LogManager lm = LogManager.getLogManager();
        InputStream ins = JAXRSLoggingAtomPushTest.class.getResourceAsStream(propFile);
        String s = IOUtils.readStringFromStream(ins);
        ins.close();
        s = s.replaceAll("9080", PORT);
        lm.readConfiguration(new ByteArrayInputStream(s.getBytes("UTF-8")));
    }

    private static void logSixEvents(Logger log) {
        log.severe("severe message");
        log.warning("warning message");
View Full Code Here


            server.destroy();
        }
        LogManager lm = LogManager.getLogManager();
        try {
            // restoring original configuration to not use tested logging handlers
            lm.readConfiguration();
        } catch (Exception e) {
            // ignore missing config file
        }
    }
View Full Code Here

            usage();
            System.exit(-1);
       
       
  LogManager logMan=LogManager.getLogManager();
  logMan.readConfiguration(Thread.currentThread().getClass().getResourceAsStream("/logging.properties"));
   
        ArrayList<Experiment> toDo = runList(args);
        String name = toDo.get(0).getExperimentName();
        ExperimentRunner runner = new ExperimentRunner();
        Logger.getLogger(RunFile.class.getName()).log(Level.INFO, String.format( "[%s] Starting clustering of %d files",name, toDo.size()));
View Full Code Here

        final ClassLoader cl = getClass().getClassLoader();
        AccessController.doPrivileged(new PrivilegedAction() {
            public Object run () {
                try {
                    InputStream config = cl.getResourceAsStream(PROPERIES_FILE);
                    logManager.readConfiguration(config);
                    return null;
                }
                catch (IOException ex) {
                    throw new RuntimeException(
                        msg.msg("EXC_LoggerSetupIOException", //NOI18N
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

            props.put("testConfigClass.foo.level", "OFF");
            props.put("testConfigClass.foo.handlers", "java.util.logging.ConsoleHandler");       
            props.put(".level", "FINEST");
            props.remove("handlers");
            InputStream in = EnvironmentHelper.PropertiesToInputStream(props);
            man.readConfiguration(in);
        }
    }
   
  public static class MockInvalidInitClass {
    public MockInvalidInitClass() {
View Full Code Here

      checkPropertyNull(manager);
      assertEquals(0, root.getHandlers().length);
      assertEquals(Level.INFO, root.getLevel());

      try {
        manager.readConfiguration();
      } catch (Exception e) {
        e.printStackTrace();
      }
      checkProperty(manager);
      assertNull(root.getHandlers()[0].getLevel());
View Full Code Here

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

      assertEquals(2, root.getHandlers().length);
      assertEquals(root.getHandlers()[0].getLevel(), Level.OFF);
      assertEquals(Level.ALL, root.getLevel());

      try {
        manager.readConfiguration();
      } catch (Exception e) {
        e.printStackTrace();
      }
      checkPropertyNull(manager);
      assertEquals(root.getHandlers()[0].getLevel(), Level.OFF);
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

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.