当前位置: 首页>>代码示例>>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;未经允许,请勿转载。