當前位置: 首頁>>代碼示例>>Java>>正文


Java LogRecord.getSequenceNumber方法代碼示例

本文整理匯總了Java中java.util.logging.LogRecord.getSequenceNumber方法的典型用法代碼示例。如果您正苦於以下問題:Java LogRecord.getSequenceNumber方法的具體用法?Java LogRecord.getSequenceNumber怎麽用?Java LogRecord.getSequenceNumber使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.util.logging.LogRecord的用法示例。


在下文中一共展示了LogRecord.getSequenceNumber方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testReadAToolbar

import java.util.logging.LogRecord; //導入方法依賴的package包/類
public void testReadAToolbar() throws Exception {
    InputStream is = getClass().getResourceAsStream("NB_PROF634066243");
    SortedMap<Integer,InputGesture> expectedGestures = new TreeMap<Integer,InputGesture>();
    expectedGestures.put(62, InputGesture.TOOLBAR);
    expectedGestures.put(63, InputGesture.MENU);
    TestHandler records = new TestHandler(is);
    for (int cnt = 0;; cnt++) {
        LOG.log(Level.INFO, "Reading {0}th record", cnt);
        LogRecord r = records.read();
        if (r == null) {
            break;
        }
        if (r.getSequenceNumber() > expectedGestures.lastKey()) {
            break;
        }
        LOG.log(Level.INFO, "Read {0}th record, seq {1}", new Object[] { cnt, r.getSequenceNumber() });

        InputGesture g = InputGesture.valueOf(r);
        InputGesture exp = expectedGestures.get((int)r.getSequenceNumber());
        assertEquals(cnt + ": For: " + r.getSequenceNumber() + " txt:\n`"+ r.getMessage() +
            "\nkey: " + r.getResourceBundleName()
            , exp, g);
    }
    is.close();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:26,代碼來源:InputGestureTest.java

示例2: publish

import java.util.logging.LogRecord; //導入方法依賴的package包/類
@Override
public void publish(LogRecord record) {
    long sn = record.getSequenceNumber();
    if (afterLast) {
        if (sn <= lastNumber) {
            return ;
        } else {
            afterLast = false;
        }
    }
    lastNumber = sn;
    hd.publish(record);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:14,代碼來源:LogRecords.java

示例3: testReadALogAndTestInputGestures

import java.util.logging.LogRecord; //導入方法依賴的package包/類
public void testReadALogAndTestInputGestures() throws Exception {
    InputStream is = getClass().getResourceAsStream("NB1216449736.0");
    SortedMap<Integer,InputGesture> expectedGestures = new TreeMap<Integer,InputGesture>();
    expectedGestures.put(35, InputGesture.MENU);
    expectedGestures.put(59, InputGesture.KEYBOARD);
    expectedGestures.put(66, InputGesture.MENU);
    expectedGestures.put(80, InputGesture.MENU);
    expectedGestures.put(81, InputGesture.MENU);
    expectedGestures.put(177, InputGesture.KEYBOARD);
    expectedGestures.put(197, InputGesture.KEYBOARD);
    expectedGestures.put(205, InputGesture.MENU);
    TestHandler records = new TestHandler(is);
    for (int cnt = 0;; cnt++) {
        LOG.log(Level.INFO, "Reading {0}th record", cnt);
        LogRecord r = records.read();
        if (r == null) {
            break;
        }
        if (r.getSequenceNumber() > expectedGestures.lastKey()) {
            break;
        }
        LOG.log(Level.INFO, "Read {0}th record, seq {1}", new Object[] { cnt, r.getSequenceNumber() });

        InputGesture g = InputGesture.valueOf(r);
        InputGesture exp = expectedGestures.get((int)r.getSequenceNumber());
        assertEquals(cnt + ": For: " + r.getSequenceNumber() + " txt:\n`"+ r.getMessage() +
            "\nkey: " + r.getResourceBundleName()
            , exp, g);
    }
    is.close();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:32,代碼來源:InputGestureTest.java

示例4: buildParameters

import java.util.logging.LogRecord; //導入方法依賴的package包/類
private Object[] buildParameters(LogRecord record) {
    StackTraceElement frame = getCaller();

    Object[] arguments = new Object[otherPartsSize + 1];
    arguments[0] = new Long(record.getSequenceNumber());
    arguments[1] = new Date(record.getMillis());
    arguments[2] = record.getLoggerName();
    arguments[3] = record.getSourceClassName();
    arguments[4] = record.getSourceMethodName();
    if (frame != null) {
        arguments[5] = frame.getFileName();
        arguments[6] = frame.getLineNumber();
    } else {
        arguments[5] = "";
        arguments[6] = -1;
    }
    // LogRecord.getThreadID is not the actual thread ID.
    // arguments[7]=new Integer(record.getThreadID());
    arguments[7] = Thread.currentThread().getId();
    arguments[12] = Thread.currentThread().getName();

    // arguments[8]=record.getLevel().getLocalizedName();
    // this is faster, but not i18n
    arguments[8] = record.getLevel().getName();
    arguments[9] = new Integer(record.getLevel().intValue());
    arguments[11] = writeThrowable(arguments, record, 0);
    return arguments;
}
 
開發者ID:Hitachi-Data-Systems,項目名稱:Open-DM,代碼行數:29,代碼來源:DefaultFormatter.java


注:本文中的java.util.logging.LogRecord.getSequenceNumber方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。