Package java.util.logging

Examples of java.util.logging.LogManager$LoggerWeakRef


  {
    if (logger != null)
      return;
   
    System.setProperty("java.util.logging.config.file", PROPERTIES_FILE);
    LogManager logManager = LogManager.getLogManager();
    try
    {
      logManager.readConfiguration();
    }
    catch (IOException e){}
    logger = Logger.getLogger("");   
    textarea = new JTextArea();
    textarea.setLineWrap(true);
View Full Code Here


                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

            if (useShutdownHook) {
                Runtime.getRuntime().removeShutdownHook(shutdownHook);

                // If JULI is being used, re-enable JULI's shutdown to ensure
                // log messages are not lost
                LogManager logManager = LogManager.getLogManager();
                if (logManager instanceof ClassLoaderLogManager) {
                    ((ClassLoaderLogManager) logManager).setUseShutdownHook(
                            true);
                }
            }
View Full Code Here

            } catch (Throwable 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

    @Test
    public void testQuietLogging() throws Exception {

        final List<LogRecord> logRecords = new ArrayList<LogRecord>();
        LogManager logManager = LogManager.getLogManager();
        logManager.reset();
        Handler handler = new Handler() {
            @Override
            public void publish(LogRecord record) {
                logRecords.add(record);
            }
View Full Code Here

            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

                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

  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

     * 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

    }
  }

  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

TOP

Related Classes of java.util.logging.LogManager$LoggerWeakRef

Copyright © 2018 www.massapicom. 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.