Package java.util.logging

Examples of java.util.logging.LogRecord


        Configuration config = instance();
        config.configLogger = logger;
        if (config.startupLogRecords != null) {
            Iterator iter = config.startupLogRecords.iterator();
            while (iter.hasNext()) {
                LogRecord lr = (LogRecord) iter.next();
                logger.log(lr.getLevel(), lr.getMessage());
            }
            config.startupLogRecords = null;
        }
    }
View Full Code Here


   * @param msg
   * @param t
   */
  private void log(String callerFQCN, Level level, String msg, Throwable t) {
    // millis and thread are filled by the constructor
    LogRecord record = new LogRecord(level, msg);
    record.setLoggerName(getName());
    record.setThrown(t);
    fillCallerData(callerFQCN, record);
    logger.log(record);

  }
View Full Code Here

    log4jCategory.log(org.apache.log4j.Level.DEBUG, "world"+(++n));
   
    assertEquals(n, listHandler.list.size());

    for (int i = 0; i < n; i++) {
      LogRecord logRecord = (LogRecord) listHandler.list.get(i);
      assertEquals("test", logRecord.getSourceMethodName());
    }
  }
View Full Code Here

    log4jCategory.fatal("msg" +(n++));
    assertEquals(n, listHandler.list.size());
   
    for(int i = 0; i < n; i++) {
      LogRecord logRecord = (LogRecord) listHandler.list.get(i);
      assertEquals("testBug131", logRecord.getSourceMethodName());  
    }
  }
View Full Code Here

   * @return may return null
   *
   */
  public LogRecord get()
  {
    LogRecord r = null;
    if (numElems > 0)
    {
      numElems--;
      r = records[first];
      records[first] = null;
View Full Code Here

        }
        return true;
    }

    private void logException(Level logLevel, Throwable e) {
        LogRecord record = new LogRecord( logLevel, e.getMessage() );
        record.setThrown( e );
        log.log( record );
    }
View Full Code Here

            try {
               log.info("Dump start");
               I_Authenticate auth = xmlBlasterMain.getAuthenticate();
               StringBuffer buf = new StringBuffer(auth.toXml());
               buf.append(xmlBlasterMain.getXmlBlaster().toXml());
               LogRecord record = new LogRecord(Level.INFO, buf.toString());
               log(record);
               log.info("Dump end");
            }
            catch(XmlBlasterException ee) {
               log.severe("Sorry, dump failed: " + ee.getMessage());
View Full Code Here

            try {
               log.info("Dump start");
               I_Authenticate auth = xmlBlasterMain.getAuthenticate();
               StringBuffer buf = new StringBuffer(auth.toXml());
               buf.append(xmlBlasterMain.getXmlBlaster().toXml());
               LogRecord record = new LogRecord(Level.INFO, buf.toString());
               log(record);
               log.info("Dump end");
            }
            catch(XmlBlasterException ee) {
               log.severe("Sorry, dump failed: " + ee.getMessage());
View Full Code Here

    });
    LoggingPanel lp=new LoggingPanel(f,"test",null);
    f.getContentPane().add(lp);

    LoggingTableModel lm=(LoggingTableModel)lp.getLogbookModel();
    lm.add(new LogRecordLoggingEntry(new LogRecord(Level.SEVERE,"DEAD")));
    lm.add(new LogRecordLoggingEntry(new LogRecord(Level.WARNING,"CAUTION")));
        lm.add(new LogRecordLoggingEntry(new LogRecord(SimtoolsLevel.USER_WARNING,"titi")));
    lm.add(new LogRecordLoggingEntry(new LogRecord(Level.INFO,"YES")));
    lm.add(new LogRecordLoggingEntry(new LogRecord(Level.CONFIG,"NO")));
    lm.add(new LogRecordLoggingEntry(new LogRecord(Level.FINE,"WHY")));
    lm.add(new LogRecordLoggingEntry(new LogRecord(Level.FINER,"WHO")));
    lm.add(new LogRecordLoggingEntry(new LogRecord(Level.FINEST,"WHEN")));
   
    f.pack();
    f.show();
  }
View Full Code Here

    public void testLogParamsSubstitutionWithThrowable() throws Exception {
        Handler handler = EasyMock.createNiceMock(Handler.class);
        LOG.addHandler(handler);
        // handler called *after* localization of message
        Exception ex = new Exception();
        LogRecord record = new LogRecord(Level.SEVERE, "subbed in 4 & 3");
        record.setThrown(ex);
        EasyMock.reportMatcher(new LogRecordMatcher(record));
        handler.publish(record);
        EasyMock.replay(handler);
        LogUtils.log(LOG, Level.SEVERE, "SUB2_MSG", ex, new Object[] {3, 4});
        EasyMock.verify(handler);
View Full Code Here

TOP

Related Classes of java.util.logging.LogRecord

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.