Examples of LogManager


Examples of java.util.logging.LogManager

            Runtime.getRuntime().addShutdownHook(shutdownHook);

            // If JULI is being used, disable JULI's shutdown hook since
            // shutdown hooks run in parallel and log messages may be lost
            // if JULI's hook completes before the CatalinaShutdownHook()
            LogManager logManager = LogManager.getLogManager();
            if (logManager instanceof ClassLoaderLogManager) {
                ((ClassLoaderLogManager) logManager).setUseShutdownHook(
                        false);
            }
        }
View Full Code Here

Examples of java.util.logging.LogManager

                ExceptionUtils.handleThrowable(ex);
                log.error(sm.getString("catalina.shutdownHookFail"), ex);
            } finally {
                // If JULI is used, shut JULI down *after* the server shuts down
                // so log messages aren't lost
                LogManager logManager = LogManager.getLogManager();
                if (logManager instanceof ClassLoaderLogManager) {
                    ((ClassLoaderLogManager) logManager).shutdown();
                }
            }
        }
View Full Code Here

Examples of java.util.logging.LogManager

  public void test_addLoggerLLogger_Security() throws Exception {
    // regression test for Harmony-1286
    SecurityManager originalSecurityManager = System.getSecurityManager();
    System.setSecurityManager(new SecurityManager());
    try {
      LogManager manager = LogManager.getLogManager();
      manager.addLogger(new MockLogger("mock", null));
      manager.addLogger(new MockLogger("mock.child", null));
    } finally {
      System.setSecurityManager(originalSecurityManager);
    }
  }
View Full Code Here

Examples of java.util.logging.LogManager

     * mock classes
   * ----------------------------------------------------
   */
    public static class ConfigClass {
        public ConfigClass() throws Exception{
            LogManager man = LogManager.getLogManager();
            Properties props = LogManagerTest.initProps();
            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);
        }
View Full Code Here

Examples of java.util.logging.LogManager

    }
  }

  public static class TestInvalidConfigFile {
    public static void main(String[] args) {
      LogManager manager = LogManager.getLogManager();
      Logger root = manager.getLogger("");
      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());
      assertEquals(1, root.getHandlers().length);
      assertEquals(Level.INFO, root.getLevel());

      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

Examples of java.util.logging.LogManager

    }
  }

  public static class TestValidConfigFile {
    public static void main(String[] args) {
      LogManager manager = LogManager.getLogManager();
      Logger root = manager.getLogger("");
      checkPropertyNull(manager);
      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);
      assertEquals(2, root.getHandlers().length);
      assertEquals(Level.ALL, root.getLevel());

      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

Examples of java.util.logging.LogManager

    }
  }

  public static class TestMockLogManager {
    public static void main(String[] args) {
      LogManager manager = LogManager.getLogManager();
      assertTrue(manager instanceof MockLogManager);
    }
View Full Code Here

Examples of java.util.logging.LogManager

    }
  }

  public static class TestValidConfigClass {
    public static void main(String[] args) {
      LogManager manager = LogManager.getLogManager();
      Logger root = manager.getLogger("");
      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);
      assertEquals(Level.OFF, root.getLevel());

      try {
        manager.readConfiguration();
      } catch (Exception e) {
        e.printStackTrace();
      }
      checkPropertyNull(manager);
      assertEquals(1, root.getHandlers().length);
      assertEquals(Level.OFF, root.getLevel());

      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

Examples of org.apache.axis2.transport.testkit.util.LogManager

        super.addTest(test);
    }

    @Override
    public void run(TestResult result) {
        LogManager logManager = LogManager.INSTANCE;
        if (!reuseResources) {
            super.run(result);
        } else {
            TestResourceSet resourceSet = null;
            for (Enumeration<?> e = tests(); e.hasMoreElements(); ) {
                Test test = (Test)e.nextElement();
                if (test instanceof ManagedTestCase) {
                    ManagedTestCase ttest = (ManagedTestCase)test;
                    TestResourceSet newResourceSet = ttest.getResourceSet();
                    try {
                        if (resourceSet == null) {
                            logManager.setTestCase(ttest);
                            newResourceSet.setUp();
                        } else {
                            TestResourceSetTransition transition = new TestResourceSetTransition(resourceSet, newResourceSet);
                            transition.tearDown();
                            logManager.setTestCase(ttest);
                            transition.setUp();
                        }
                    } catch (Throwable t) {
                        result.addError(this, t);
                        return;
                    }
                    resourceSet = newResourceSet;
                }
                runTest(test, result);
            }
            if (resourceSet != null) {
                try {
                    resourceSet.tearDown();
                    logManager.setTestCase(null);
                } catch (Throwable t) {
                    result.addError(this, t);
                    return;
                }
            }
View Full Code Here

Examples of org.apache.felix.jmood.compendium.LogManager

                server
                        .registerMBean(ca, new ObjectName(
                                ObjectNames.CM_SERVICE));
            }
            if (ac.getLogservice() != null) {
                LogManagerMBean lm = new LogManager(ac);
                server.registerMBean(lm,
                        new ObjectName(ObjectNames.LOG_SERVICE));
            }
            if (ac.getUserAdmin() != null) {
                UserManagerMBean um = new UserManager(ac);
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.