Java Code Examples for java.util.logging.Level.FINER

The following are Jave code examples for showing how to use FINER of the java.util.logging.Level class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: incubator-netbeans   File: LookupSensitiveAction.java   View Source Code Vote up 6 votes
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;
}
 
Example 2
Project: incubator-netbeans   File: LogRecordsTest.java   View Source Code Vote up 5 votes
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());
    }
}
 
Example 3
Project: incubator-netbeans   File: LogRecordsTest.java   View Source Code Vote up 5 votes
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;
}
 
Example 4
Project: jdk8u-jdk   File: AbstractSaslImpl.java   View Source Code Vote up 5 votes
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);
    }
}
 
Example 5
Project: incubator-netbeans   File: ActionsSearchProvider.java   View Source Code Vote up 5 votes
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);
}
 
Example 6
Project: incubator-netbeans   File: SystemFileSystem.java   View Source Code Vote up 5 votes
@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);
    }
}
 
Example 7
Project: uavstack   File: PLogger.java   View Source Code Vote up 5 votes
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;
    }
 
Example 8
Project: OpenJSharp   File: AbstractSaslImpl.java   View Source Code Vote up 5 votes
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);
    }
}
 
Example 9
Project: incubator-netbeans   File: StampsIdeLessThanPlatformTest.java   View Source Code Vote up 4 votes
@Override
protected Level logLevel() {
    return Level.FINER;
}
 
Example 10
Project: incubator-netbeans   File: URLsAreEqualTest.java   View Source Code Vote up 4 votes
@Override
protected Level logLevel() {
    return Level.FINER;
}
 
Example 11
Project: incubator-netbeans   File: EvaluatorTest.java   View Source Code Vote up 4 votes
@Override
protected Level logLevel() {
    return Level.FINER;
}
 
Example 12
Project: incubator-netbeans   File: DataShadowTest.java   View Source Code Vote up 4 votes
protected Level logLevel() {
    return Level.FINER;
}
 
Example 13
Project: incubator-netbeans   File: ReloadTest.java   View Source Code Vote up 4 votes
protected @Override Level logLevel() {
    return Level.FINER;
}
 
Example 14
Project: incubator-netbeans   File: TestNGOutputReader.java   View Source Code Vote up 4 votes
/**
     */
    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);
    }
 
Example 15
Project: incubator-netbeans   File: NbInstallerHideClasspathPackagesTest.java   View Source Code Vote up 4 votes
@Override
protected Level logLevel() {
    return Level.FINER;
}
 
Example 16
Project: incubator-netbeans   File: FileUtilAddRecursiveListenerTest.java   View Source Code Vote up 4 votes
@Override
protected Level logLevel() {
    return Level.FINER;
}
 
Example 17
Project: incubator-netbeans   File: RecursiveListenerOnOffTest.java   View Source Code Vote up 4 votes
@Override
protected Level logLevel() {
    return Level.FINER;
}
 
Example 18
Project: incubator-netbeans   File: FileUtilAddRecursiveListenerOnClassFileTest.java   View Source Code Vote up 4 votes
@Override
protected Level logLevel() {
    return Level.FINER;
}
 
Example 19
Project: incubator-netbeans   File: InstanceDataObjectRefreshesOnFileChangeTest.java   View Source Code Vote up 4 votes
@Override
protected Level logLevel() {
    return Level.FINER;
}
 
Example 20
Project: incubator-netbeans   File: TopComponentGetLookupTest.java   View Source Code Vote up 4 votes
@Override
protected Level logLevel() {
    return Level.FINER;
}