当前位置: 首页>>代码示例>>Java>>正文


Java Level.FINER属性代码示例

本文整理汇总了Java中java.util.logging.Level.FINER属性的典型用法代码示例。如果您正苦于以下问题:Java Level.FINER属性的具体用法?Java Level.FINER怎么用?Java Level.FINER使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在java.util.logging.Level的用法示例。


在下文中一共展示了Level.FINER属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doRefresh

private void doRefresh(boolean immediate) {
    if (refreshing) {
        return;
    }
    refreshing = true;
    try {
        if (LOG.isLoggable(Level.FINER)) {
            LogRecord r = new LogRecord(Level.FINER, "LOG_ACTION_REFRESH"); // NOI18N
            r.setResourceBundle(NbBundle.getBundle(LookupSensitiveAction.class));
            r.setParameters(new Object[]{
                getClass(),
                lookup
            });
            r.setLoggerName(LOG.getName());
            LOG.log(r);
        }
        refresh(lookup, immediate);
    } finally {
        refreshing = false;
    }
    needsRefresh = false;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:LookupSensitiveAction.java

示例2: testDoesNotAskForWrongBunles

public void testDoesNotAskForWrongBunles() throws Exception {
    LogRecord rec = new LogRecord(Level.FINER, "UI_ACTION_BUTTON_PRESS"); // NOI18N
    rec.setParameters(new Object[] { "0", "1" });
    rec.setResourceBundle(ResourceBundle.getBundle(LogRecordsTest.class.getPackage().getName() + ".Props"));
    
    ByteArrayOutputStream os = new ByteArrayOutputStream();
    LogRecords.write(os, rec);
    os.close();
    
    
    class H extends Handler {
        int cnt;
        
        public void publish(LogRecord arg0) {
            cnt++;
            assertNotNull("We have params " + cnt, arg0.getParameters());
            assertEquals("Two argument for " + cnt + "th record", 2, arg0.getParameters().length);
        }

        public void flush() {
        }

        public void close() throws SecurityException {
        }
    }
    H h = new H();
    
    CharSequence log = Log.enable("", Level.FINEST);
    LogRecords.scan(new ByteArrayInputStream(os.toByteArray()), h);

    assertEquals("One record", 1, h.cnt);
    
    if (log.toString().indexOf("Cannot find resource") < 0) {
        fail(log.toString());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:36,代码来源:LogRecordsTest.java

示例3: randomLevel

private static Level randomLevel(Random r) {
    int lev = r.nextInt(1100);
    if (lev >= Level.SEVERE.intValue()) return Level.SEVERE;
    if (lev >= Level.WARNING.intValue()) return Level.WARNING;
    if (lev >= Level.INFO.intValue()) return Level.INFO;
    if (lev >= Level.CONFIG.intValue()) return Level.CONFIG;
    if (lev >= Level.FINE.intValue()) return Level.FINE;
    if (lev >= Level.FINER.intValue()) return Level.FINER;
    if (lev >= Level.FINEST.intValue()) return Level.FINEST;
    return Level.OFF;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:LogRecordsTest.java

示例4: traceOutput

protected static final void traceOutput(String srcClass, String srcMethod,
    String traceTag, byte[] output, int offset, int len) {
    try {
        int origlen = len;
        Level lev;

        if (!logger.isLoggable(Level.FINEST)) {
            len = Math.min(16, len);
            lev = Level.FINER;
        } else {
            lev = Level.FINEST;
        }

        String content;

        if (output != null) {
            ByteArrayOutputStream out = new ByteArrayOutputStream(len);
            new HexDumpEncoder().encodeBuffer(
                new ByteArrayInputStream(output, offset, len), out);
            content = out.toString();
        } else {
            content = "NULL";
        }

        // Message id supplied by caller as part of traceTag
        logger.logp(lev, srcClass, srcMethod, "{0} ( {1} ): {2}",
            new Object[] {traceTag, new Integer(origlen), content});
    } catch (Exception e) {
        logger.logp(Level.WARNING, srcClass, srcMethod,
            "SASLIMPL09:Error generating trace output: {0}", e);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:32,代码来源:AbstractSaslImpl.java

示例5: uiLog

private void uiLog(boolean success) {
    LogRecord rec = new LogRecord(Level.FINER, success?"LOG_QUICKSEARCH_ACTION":"LOG_QUICKSEARCH_ACTION_FAILED"); // NOI18N
    rec.setParameters(new Object[] { command.getClass().getName(), command.getValue(Action.NAME) });
    rec.setResourceBundle(NbBundle.getBundle(ActionsSearchProvider.class));
    rec.setResourceBundleName(ActionsSearchProvider.class.getPackage().getName() + ".Bundle"); // NOI18N
    rec.setLoggerName(UILOG.getName());
    UILOG.log(rec);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:ActionsSearchProvider.java

示例6: log

@Messages({"# {0} - type", "# {1} - path to the file", "# {2} - file object itself", "# {3} - event itself", "LOG_FILE_EVENT=File event {0}, file {1}"})
private static void log(String type, FileEvent fe) {
    if (LOG.isLoggable(Level.FINER)) {
        LogRecord r = new LogRecord(Level.FINER, "LOG_FILE_EVENT");
        r.setLoggerName(LOG.getName());
        r.setParameters(new Object[] {
            type,
            fe.getFile().getPath(),
            fe.getFile(),
            fe
        });
        r.setResourceBundle(NbBundle.getBundle(SystemFileSystem.class));
        LOG.log(r);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:SystemFileSystem.java

示例7: getLevel

private static Level getLevel(LogLevel level) {

        Level l = Level.INFO;
        switch (level) {
            case ALL:
                l = Level.ALL;
                break;
            case DEBUG:
                l = Level.FINEST;
                break;
            case ERR:
                l = Level.SEVERE;
                break;
            case FINE:
                l = Level.FINE;
                break;
            case FINER:
                l = Level.FINER;
                break;
            case INFO:
                l = Level.INFO;
                break;
            case WARNING:
                l = Level.WARNING;
                break;
            default:
                l = Level.INFO;
                break;
        }
        return l;
    }
 
开发者ID:uavorg,项目名称:uavstack,代码行数:31,代码来源:PLogger.java

示例8: logLevel

@Override
protected Level logLevel() {
    return Level.FINER;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:StampsIdeLessThanPlatformTest.java

示例9: logLevel

protected Level logLevel() {
    return Level.FINER;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:3,代码来源:DataShadowTest.java

示例10: logLevel

protected @Override Level logLevel() {
    return Level.FINER;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:3,代码来源:ReloadTest.java

示例11: isValidReportFile

/**
     */
    private boolean isValidReportFile(File reportFile) {
        if (!reportFile.canRead()) {
            return false;
        }

        if (reportFile.canRead()) {
            return true;
        }

        long lastModified = reportFile.lastModified();
        long timeDelta = lastModified - timeOfSessionStart;

        final Logger logger = Logger.getLogger("org.netbeans.modules.testng.outputreader.timestamps");//NOI18N
        final Level logLevel = Level.FINER;
        if (logger.isLoggable(logLevel)) {
            logger.log(logLevel, "Report file: " + reportFile.getPath());//NOI18N

            final GregorianCalendar timeStamp = new GregorianCalendar();

            timeStamp.setTimeInMillis(timeOfSessionStart);
            logger.log(logLevel, "Session start:    " + String.format("%1$tT.%2$03d", timeStamp, timeStamp.get(Calendar.MILLISECOND)));//NOI18N

            timeStamp.setTimeInMillis(lastModified);
            logger.log(logLevel, "Report timestamp: " + String.format("%1$tT.%2$03d", timeStamp, timeStamp.get(Calendar.MILLISECOND)));//NOI18N
        }

        if (timeDelta >= 0) {
            return true;
        }

        /*
         * Normally we would return 'false' here, but:
         *
         * We must take into account that modification timestamps of files
         * usually do not hold milliseconds, just seconds. The worst case we
         * must accept is that the session started on YYYY.MM.DD hh:mm:ss.999
         * and the file was saved exactly in the same millisecond but its time
         * stamp is just YYYY.MM.DD hh:mm:ss, i.e 999 milliseconds earlier.
         */
        return -timeDelta <= timeOfSessionStart % 1000;

//        if (timeDelta < -999) {
//            return false;
//        }
//
//        final GregorianCalendar sessStartCal = new GregorianCalendar();
//        sessStartCal.setTimeInMillis(timeOfSessionStart);
//        int sessStartMillis = sessStartCal.get(Calendar.MILLISECOND);
//        if (timeDelta < -sessStartMillis) {
//            return false;
//        }
//
//        final GregorianCalendar fileModCal = new GregorianCalendar();
//        fileModCal.setTimeInMillis(lastModified);
//        if (fileModCal.get(Calendar.MILLISECOND) != 0) {
//            /* So the file's timestamp does hold milliseconds! */
//            return false;
//        }
//
//        /*
//         * Now we know that milliseconds are not part of file's timestamp.
//         * Let's substract the milliseconds part and check whether the delta is
//         * non-negative, now that we only check seconds:
//         */
//        return lastModified >= (timeOfSessionStart - sessStartMillis);
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:68,代码来源:TestNGOutputReader.java


注:本文中的java.util.logging.Level.FINER属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。