Package java.util.logging

Examples of java.util.logging.Logger


public final class HttpClientRetryTest {

   
    public static void main(String[] args) throws Exception {
       
        Logger LOG = Logger.getLogger(HttpClientRetryTest.class.getName());
       
        for (int i = 0; i < 10000; i++) {
            LOG.info("loop " + i);
            new HttpClientRetryTest().testPutRetry2();
        }
    }
View Full Code Here


            if(post.containsKey("filter")){
                filter = post.get("filter");
            }
        }

        final Logger logger = Logger.getLogger("");
        final Handler[] handlers = logger.getHandlers();
        boolean displaySubmenu = false;
        for (final Handler handler : handlers) {
            if (handler instanceof GuiHandler) {
                maxlines = ((GuiHandler)handler).getSize();
                if (lines > maxlines) lines = maxlines;
View Full Code Here

        ((LoggingBufferTableModel)lp.getLogbookModel()).startRefreshLoop();
      } catch(IOException ie){
        ie.printStackTrace();
        System.exit(0);
      }
      Logger lr = null;
      try {
        SocketBufferHandler sbh=new SocketBufferHandler("localhost",4321);
        lr=Logger.getLogger("TEST");
        lr.addHandler(sbh);
        lr.setUseParentHandlers(false);
        lr.warning("Start");
      } catch (IOException e) {
        e.printStackTrace();
        System.exit(0);
      }
      f.addWindowListener( new WindowAdapter() {
        public void windowClosing(WindowEvent e){
          try {
            buffer.closeServer();
          } catch (IOException e1) {
            e1.printStackTrace();
            System.exit(0);
          }
          new TestBinary(buffer,"TEST");
        }
      });

      f.pack();
      f.show();

      int i=0;
      while(true){
        lr.info("Write "+i);
        i++;
        if(i%10==0){
          lr.log(Level.SEVERE,"dummy",new IOException("bar"));
        }
        try {
          Thread.sleep(100);
        } catch (InterruptedException e1) {
          e1.printStackTrace();
View Full Code Here

   *
   * @param name the logger name
   * @return the new logger as returned by Logger.getLogger(name)
   */
  public static Logger getLogger(String name){
    Logger res=Logger.getLogger(name);
    synchronized(configuratorsLock){
      for(int i=0;i<configurators.size();i++){
        ((LogConfigurator)configurators.get(i)).apply(res);
      }
    }
View Full Code Here

                outHandler.setLevel(lowestLevel);
            }
        }
    Enumeration e=lm.getLoggerNames();
    while(e.hasMoreElements()){
      Logger l=lm.getLogger((String)e.nextElement());
      apply(l);
    }
  }
View Full Code Here

    Map<String, Level> result = new HashMap<String, Level>();
    LogManager logManager = LogManager.getLogManager();
    Enumeration loggerNames = logManager.getLoggerNames();
    while ( loggerNames.hasMoreElements() ){
      String loggerName = (String)loggerNames.nextElement();
      Logger logger = logManager.getLogger(loggerName);
      result.put(loggerName, logger.getLevel());
    }
    return sortMap(result);
  }
View Full Code Here

      } catch (ConfigurationManagerException e) {
        e.printStackTrace();
      }
    }

    Logger log = Logger.getLogger("org.jmule");
   
    /**Setup logger*/
   
    log.setLevel(Level.ALL);//Log all events
   
    try {
      FileHandler fileHandler = new FileHandler(ConfigurationManager.LOGS_DIR+File.separator+"JMule%u.log",(int)ConfigurationManager.LOG_FILE_SIZE,ConfigurationManager.LOG_FILES_NUMBER);
     
      fileHandler.setFormatter(new SimpleFormatter());
     
      log.addHandler(fileHandler);
     
    } catch (Throwable e) {
     
      e.printStackTrace();
    }
View Full Code Here

  @Test
  public void testHttpClientWithAuthMissingPassword() throws Exception {
   
    System.out.println("testHttpClientWithAuthMissingPassword");

    Logger LOG = Logger.getLogger("org.xlightweb.test");
   
    LOG.fine("start proxy");
    HttpProxy2 proxy = new HttpProxy2(true);
    proxy.start();
   
   
    HttpClient httpClient = new HttpClient();
    httpClient.setProxyHost("localhost");
    httpClient.setProxyPort(proxy.getLocalPort());
    httpClient.setProxyUser("test");
   

    try {
      LOG.fine("call");
      httpClient.call(new GetRequest("http://www.amazon.de/"));
      Assert.fail("IOException expected");
    } catch (IOException expected) {  }
   
   
    LOG.fine("returned");
    httpClient.close();
    proxy.close();
 
View Full Code Here

        start_msec = prev.start_msec;
        hasBeenUsed = true;
    }

    public static void enableLogging() {
        Logger logger = Logger.getLogger(com.sun.tools.javac.Main.class.getPackage().getName());
        logger.setLevel(Level.ALL);
        for (Handler h : logger.getParent().getHandlers()) {
            h.setLevel(Level.ALL);
       }

    }
View Full Code Here

   private Logger[] getLoggers() {
      Enumeration e = LogManager.getLogManager().getLoggerNames();
      ArrayList list = new ArrayList();
      while (e.hasMoreElements()) {
         String name = (String)e.nextElement();
         Logger logger = LogManager.getLogManager().getLogger(name);
         if (logger != null)
            list.add(logger);
      }
      if (list.size() == 0) return new Logger[0];
      return (Logger[])list.toArray(new Logger[list.size()]);
View Full Code Here

TOP

Related Classes of java.util.logging.Logger

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.