Package java.util.logging

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


        {
            final InputStream url =
                this.getClass().getClassLoader().getResourceAsStream(RESOURCE_LOGGING_PROPERTIES);
            try
            {
                lm.readConfiguration(url);
            } catch (IOException e)
            {
                System.err.println(Strings.error("logging.unable.to.use.production.configuration"));
                e.printStackTrace();
            }
View Full Code Here


                consoleHandler.setFormatter(
                    new BasicTextJdkLogFormatter(false));
                consoleHandler.setLevel(Level.INFO);
                istream = FrameworkLogger.class.getResourceAsStream(path);
                lm.readConfiguration(istream);

                Logger cmdlineLogger = Logger.getLogger("org.hsqldb.cmdline");

                cmdlineLogger.addHandler(consoleHandler);
                cmdlineLogger.setUseParentHandlers(false);
View Full Code Here

                cmdlineLogger.setUseParentHandlers(false);
            } else {

                // Do not intervene.  Use JDK logging exactly as configured
                // by user.
                lm.readConfiguration();

                // The only bad thing about doing this is that if the app
                // has programmatically changed the logging config after
                // starting the program but before using FrameworkLogger,
                // we will clobber those customizations.
View Full Code Here

        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

      // 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

            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

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.