Package java.util.logging

Examples of java.util.logging.Logger.addHandler()


        // set up our custom log handler to pipe messages to the LogViewerFrame.
        // We need to do this to work around the fact that Web Start won't
        // load loggers not on the system classpath
        Logger rootLogger = Logger.getLogger("");
        rootLogger.addHandler(new LogViewerHandler());

        // make sure Swing exceptions are captured in the log
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                Thread.currentThread().setUncaughtExceptionHandler(ueh);
View Full Code Here


            }
        };
        Handler ch = new ConsoleHandler();
        ch.setFormatter(sf);
        Logger globalLog = Logger.getLogger("");
        globalLog.addHandler(ch);
       
        ch.setLevel(consoleLevel);
    }

}
View Full Code Here

    // Create a log handler which prints all log events to the console
    ConsoleHandler logHandler = new ConsoleHandler();
    logHandler.setLevel(Level.ALL);
    httpLogger.addHandler(logHandler);
    xmlLogger.addHandler(logHandler);
  }



  @Test
View Full Code Here

        });
        Logger root = Logger.getLogger("");
        for (Handler handler : root.getHandlers()) {
            root.removeHandler(handler);
        }
        root.addHandler(fh);

        int port = 22;
        String host = null;
        String login = System.getProperty("user.name");
        boolean agentForward = false;
View Full Code Here

      e.printStackTrace();
    }

    formatterTxt = new GUIAlert();
    fileTxt.setFormatter(formatterTxt);
    logger.addHandler(fileTxt);
  }
}
View Full Code Here

                    // during the creation of the handler object.
                    // This includes setting level, filter, formatter and encoding.
                    this.prefix.set(null);
                    info.handlers.put(handlerName, handler);
                    if (rootHandlers == null) {
                        localRootLogger.addHandler(handler);
                    }
                } catch (Exception e) {
                    // Report error
                    System.err.println("Handler error");
                    e.printStackTrace();
View Full Code Here

        // We need to modify the JDK Logger for the NonBlockingInterceptor so we
        // can check that it logs a message for the @OneWay invocation that throws
        // an Exception
        Logger nbiLogger = Logger.getLogger(NonBlockingInterceptor.class.getName());
        DummyJDKHandler handler = new DummyJDKHandler();
        nbiLogger.addHandler(handler);

        // Add a message on the console to explain the stack dump that is going to be
        // displayed and state that this is not a problem but expected behaviour
        System.out.println();
        System.out.println("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-");
View Full Code Here

    assertNotNull(mockManager.getProperty("handlers"));
    Logger foo = new MockLogger(FOO, null);
    assertNull(foo.getLevel());
        assertEquals(0, foo.getHandlers().length);
    foo.setLevel(Level.ALL);
    foo.addHandler(new ConsoleHandler());
    assertTrue(mockManager.addLogger(foo));
    assertEquals(Level.WARNING, foo.getLevel());
    assertEquals(2, foo.getHandlers().length);

    // reset
View Full Code Here

        root = manager.getLogger("");
      } else {
        System.out.println("null manager");
      }
      if (null != root) {
        root.addHandler(handler);
        root.setLevel(Level.OFF);
      }
    }
  }
View Full Code Here

            ConsoleHandler handler = new ConsoleHandler();
            handler.setLevel(Level.FINEST);
            for (Enumeration<String> enumerator = LogManager.getLogManager().getLoggerNames(); enumerator.hasMoreElements();) {
                String loggerName = enumerator.nextElement();
                Logger logger = Logger.getLogger(loggerName);
                logger.addHandler(handler);
                logger.setLevel(Level.FINEST);
            }
        }

        String text = "Test hypothetical web server";
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.