Java Code Examples for java.util.logging.Level#FINEST

The following examples show how to use java.util.logging.Level#FINEST . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
private Level mapLevel(final String level) {

        if (level != null) {
            switch (level.toUpperCase().trim()) {
            case "CRITICAL":
            case "ERROR":
                return Level.SEVERE;
            case "WARNING":
                return Level.WARNING;
            case "INFO":
                return Level.INFO;
            case "NOTICE":
                return Level.CONFIG;
            case "DEBUG":
                return Level.FINEST;
            default:
                break;
            }
        }
        return Level.INFO;
    }
 
Example 2
private void createIcon() {
  Level[] levels = {Level.FINEST,//
    Level.FINER,//
    Level.FINE,//
    Level.CONFIG,//
    Level.INFO,//
    Level.WARNING,//
    Level.SEVERE,//
  };
  ArrayList<Icon> iconsList = new ArrayList<>();
  for (Level l : levels) {
    if (l.intValue() < levelIntValue) {
      final Icon iconByLevel = LevelRenderer.getIconByLevel(l);
      iconsList.add(iconByLevel);
    }
  }
  icon = new CompoundIcon(iconsList);
}
 
Example 3
Source Project: openjdk-jdk8u   File: Log.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Access log for a tri-state system property.
 *
 * Need to first convert override value to a log level, taking
 * care to interpret a range of values between BRIEF, VERBOSE and
 * SILENT.
 *
 * An override < 0 is interpreted to mean that the logging
 * configuration should not be overridden. The level passed to the
 * factories createLog method will be null in this case.
 *
 * Note that if oldLogName is null and old logging is on, the
 * returned LogStreamLog will ignore the override parameter - the
 * log will never log messages.  This permits new logs that only
 * write to Loggers to do nothing when old logging is active.
 *
 * Do not call getLog multiple times on the same logger name.
 * Since this is an internal API, no checks are made to ensure
 * that multiple logs do not exist for the same logger.
 */
public static Log getLog(String loggerName, String oldLogName,
                         int override)
{
    Level level;

    if (override < 0) {
        level = null;
    } else if (override == LogStream.SILENT) {
        level = Level.OFF;
    } else if ((override > LogStream.SILENT) &&
               (override <= LogStream.BRIEF)) {
        level = BRIEF;
    } else if ((override > LogStream.BRIEF) &&
               (override <= LogStream.VERBOSE))
    {
        level = VERBOSE;
    } else {
        level = Level.FINEST;
    }
    return logFactory.createLog(loggerName, oldLogName, level);
}
 
Example 4
/**
 * Generalized 2D iterable query method. Iterates over intervals that match
 * the conditions on quarks and times in the Transient State.
 *
 * @param quarks
 *            Collection of quarks for returned intervals.
 * @param timeCondition
 *            Condition on the times for returned intervals
 * @return An iterable over the queried intervals, ordered by quarks.
 * @since 2.1
 */
public Iterable<ITmfStateInterval> query2D(Collection<Integer> quarks, TimeRangeCondition timeCondition) {
    fRWLock.readLock().lock();
    try (TraceCompassLogUtils.ScopeLog log = new TraceCompassLogUtils.ScopeLog(LOGGER, Level.FINEST, "TransientState:query2D", //$NON-NLS-1$
            "ssid", fBackend.getSSID(), //$NON-NLS-1$
            "quarks", quarks, //$NON-NLS-1$
            "time", timeCondition)) { //$NON-NLS-1$
        if (!fIsActive) {
            return Collections.emptyList();
        }
        long end = timeCondition.max();
        Collection<ITmfStateInterval> iterable = new ArrayList<>();
        for (Integer quark : quarks) {
            ITmfStateInterval interval = getIntervalAt(end, quark);
            if (interval != null) {
                iterable.add(interval);
            }
        }
        return iterable;
    } finally {
        fRWLock.readLock().unlock();
    }
}
 
Example 5
Source Project: reef   File: CLRBufferedLogHandler.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Flushes the log buffer, logging each buffered log message using
 * the reef-bridge log function.
 */
private void logAll() {
  synchronized (this) {
    final StringBuilder sb = new StringBuilder();
    Level highestLevel = Level.FINEST;
    for (final LogRecord record : this.logs) {
      sb.append(formatter.format(record));
      sb.append("\n");
      if (record.getLevel().intValue() > highestLevel.intValue()) {
        highestLevel = record.getLevel();
      }
    }
    try {
      final int level = getLevel(highestLevel);
      NativeInterop.clrBufferedLog(level, sb.toString());
    } catch (Exception e) {
      System.err.println("Failed to perform CLRBufferedLogHandler");
    }

    this.logs.clear();
  }
}
 
Example 6
@Override
public Level convert(final String value) {
	if (value.equals("SEVERE"))
		return Level.SEVERE;
	else if (value.equals("WARNING"))
		return Level.WARNING;
	else if (value.equals("INFO"))
		return Level.INFO;
	else if (value.equals("CONFIG"))
		return Level.CONFIG;
	else if (value.equals("FINE"))
		return Level.FINE;
	else if (value.equals("FINER"))
		return Level.FINER;
	else if (value.equals("FINEST"))
		return Level.FINEST;
	else
		throw new RuntimeException("Incorrect Log Level.");
}
 
Example 7
Source Project: fabric-chaincode-java   File: Logging.java    License: Apache License 2.0 6 votes vote down vote up
private static Level mapLevel(final String level) {
    if (level != null) {
        switch (level.toUpperCase().trim()) {
        case "ERROR":
        case "CRITICAL":
            return Level.SEVERE;
        case "WARNING":
            return Level.WARNING;
        case "INFO":
            return Level.INFO;
        case "NOTICE":
            return Level.CONFIG;
        case "DEBUG":
            return Level.FINEST;
        default:
            return Level.INFO;
        }
    }
    return Level.INFO;
}
 
Example 8
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
Source Project: gdx-gamesvcs   File: GpgsClient.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Gdx to Log4j log level mapping
 */
private static Level getLogLevel(int logLevel) {
    switch (logLevel) {
        case Application.LOG_NONE:
            return Level.OFF;
        case Application.LOG_ERROR:
            return Level.SEVERE;
        case Application.LOG_INFO:
            return Level.INFO;
        case Application.LOG_DEBUG:
            return Level.FINEST;
        default:
            return Level.ALL;
    }
}
 
Example 10
/**
 * @return the maximum length of a log level
 */
static int findMaxLevelLength() {

	Level[] levels = new Level[] {
			Level.ALL, Level.CONFIG, Level.FINE,
			Level.FINER, Level.FINEST, Level.INFO,
			Level.OFF, Level.SEVERE, Level.WARNING
	};

	int result = -1;
	for( Level level : levels )
		result = Math.max( result, level.toString().length());

	return result;
}
 
Example 11
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 12
@Override
public void run() {
    try {
        handler.setLevel(Level.FINEST);
        while (goOn) {
            Logger l;
            Logger foo = Logger.getLogger("foo");
            Logger bar = Logger.getLogger("foo.bar");
            for (long i=0; i < nextLong.longValue() + 100 ; i++) {
                if (!goOn) break;
                l = Logger.getLogger("foo.bar.l"+i);
                final ResourceBundle b = l.getResourceBundle();
                final String name = l.getResourceBundleName();
                if (b != null) {
                    if (!name.equals(b.getBaseBundleName())) {
                        throw new RuntimeException("Unexpected bundle name: "
                                +b.getBaseBundleName());
                    }
                }
                Logger ll = Logger.getLogger(l.getName()+".bie.bye");
                ResourceBundle hrb;
                String hrbName;
                if (handler.getLevel() != Level.FINEST) {
                    throw new RuntimeException("Handler level is not finest: "
                            + handler.getLevel());
                }
                final int countBefore = handler.count;
                handler.reset();
                ll.setLevel(Level.FINEST);
                ll.addHandler(handler);
                ll.log(Level.FINE, "dummy {0}", this);
                ll.removeHandler(handler);
                final int countAfter = handler.count;
                if (countBefore == countAfter) {
                    throw new RuntimeException("Handler not called for "
                            + ll.getName() + "("+ countAfter +")");
                }
                hrb = handler.rb;
                hrbName = handler.rbName;
                if (name != null) {
                    // if name is not null, then it implies that it
                    // won't change, since setResourceBundle() cannot
                    // replace a non null name.
                    // Since we never set the resource bundle on 'll',
                    // then ll must inherit its resource bundle [name]
                    // from l - and therefor we should find it in
                    // handler.rb/handler.rbName
                    if (!name.equals(hrbName)) {
                        throw new RuntimeException("Unexpected bundle name: "
                                +hrbName);
                    }
                    // here we know that hrbName is not null so hrb
                    // should not be null either.
                    if (!name.equals(hrb.getBaseBundleName())) {
                        throw new RuntimeException("Unexpected bundle name: "
                                +hrb.getBaseBundleName());
                    }
                }

                // Make sure to refer to 'l' explicitly in order to
                // prevent eager garbage collecting before the end of
                // the test (JDK-8030192)
                if (!ll.getName().startsWith(l.getName())) {
                    throw new RuntimeException("Logger " + ll.getName()
                            + "does not start with expected prefix "
                            + l.getName());
                }

                getRBcount.incrementAndGet();
                if (!goOn) break;
                Thread.sleep(1);
            }
        }
   } catch (Exception x) {
       fail(x);
   }
}
 
Example 13
@Override
public void run() {
    try {
        handler.setLevel(Level.FINEST);
        while (goOn) {
            Logger l;
            Logger foo = Logger.getLogger("foo");
            Logger bar = Logger.getLogger("foo.bar");
            for (long i=0; i < nextLong.longValue() + 100 ; i++) {
                if (!goOn) break;
                l = Logger.getLogger("foo.bar.l"+i);
                final ResourceBundle b = l.getResourceBundle();
                final String name = l.getResourceBundleName();
                if (b != null) {
                    if (!name.equals(b.getBaseBundleName())) {
                        throw new RuntimeException("Unexpected bundle name: "
                                +b.getBaseBundleName());
                    }
                }
                Logger ll = Logger.getLogger(l.getName()+".bie.bye");
                ResourceBundle hrb;
                String hrbName;
                if (handler.getLevel() != Level.FINEST) {
                    throw new RuntimeException("Handler level is not finest: "
                            + handler.getLevel());
                }
                final int countBefore = handler.count;
                handler.reset();
                ll.setLevel(Level.FINEST);
                ll.addHandler(handler);
                ll.log(Level.FINE, "dummy {0}", this);
                ll.removeHandler(handler);
                final int countAfter = handler.count;
                if (countBefore == countAfter) {
                    throw new RuntimeException("Handler not called for "
                            + ll.getName() + "("+ countAfter +")");
                }
                hrb = handler.rb;
                hrbName = handler.rbName;
                if (name != null) {
                    // if name is not null, then it implies that it
                    // won't change, since setResourceBundle() cannot
                    // replace a non null name.
                    // Since we never set the resource bundle on 'll',
                    // then ll must inherit its resource bundle [name]
                    // from l - and therefor we should find it in
                    // handler.rb/handler.rbName
                    if (!name.equals(hrbName)) {
                        throw new RuntimeException("Unexpected bundle name: "
                                +hrbName);
                    }
                    // here we know that hrbName is not null so hrb
                    // should not be null either.
                    if (!name.equals(hrb.getBaseBundleName())) {
                        throw new RuntimeException("Unexpected bundle name: "
                                +hrb.getBaseBundleName());
                    }
                }

                // Make sure to refer to 'l' explicitly in order to
                // prevent eager garbage collecting before the end of
                // the test (JDK-8030192)
                if (!ll.getName().startsWith(l.getName())) {
                    throw new RuntimeException("Logger " + ll.getName()
                            + "does not start with expected prefix "
                            + l.getName());
                }

                getRBcount.incrementAndGet();
                if (!goOn) break;
                Thread.sleep(1);
            }
        }
   } catch (Exception x) {
       fail(x);
   }
}
 
Example 14
public static void main(String[] args) {
    System.setSecurityManager(new SecurityManager());
    Logger anonymous = Logger.getAnonymousLogger();

    final TestHandler handler = new TestHandler();
    final TestFilter filter = new TestFilter();
    final ResourceBundle bundle = ResourceBundle.getBundle(TestBundle.class.getName());
    anonymous.setLevel(Level.FINEST);
    anonymous.addHandler(handler);
    anonymous.setFilter(filter);
    anonymous.setUseParentHandlers(true);
    anonymous.setResourceBundle(bundle);

    if (anonymous.getLevel() != Level.FINEST) {
        throw new RuntimeException("Unexpected level: " + anonymous.getLevel());
    } else {
        System.out.println("Got expected level: " + anonymous.getLevel());
    }
    if (!Arrays.asList(anonymous.getHandlers()).contains(handler)) {
        throw new RuntimeException("Expected handler not found in: "
                + Arrays.asList(anonymous.getHandlers()));
    } else {
        System.out.println("Got expected handler in: " + Arrays.asList(anonymous.getHandlers()));
    }
    if (anonymous.getFilter() != filter) {
        throw new RuntimeException("Unexpected filter: " + anonymous.getFilter());
    } else {
        System.out.println("Got expected filter: " + anonymous.getFilter());
    }
    if (!anonymous.getUseParentHandlers()) {
        throw new RuntimeException("Unexpected flag: " + anonymous.getUseParentHandlers());
    } else {
        System.out.println("Got expected flag: " + anonymous.getUseParentHandlers());
    }
    if (anonymous.getResourceBundle() != bundle) {
        throw new RuntimeException("Unexpected bundle: " + anonymous.getResourceBundle());
    } else {
        System.out.println("Got expected bundle: " + anonymous.getResourceBundle());
    }
    try {
        anonymous.setParent(Logger.getLogger("foo.bar"));
        throw new RuntimeException("Expected SecurityException not raised!");
    } catch (SecurityException x) {
        System.out.println("Got expected exception: " + x);
    }
    if (anonymous.getParent() != Logger.getLogger("")) {
        throw new RuntimeException("Unexpected parent: " + anonymous.getParent());
    } else {
        System.out.println("Got expected parent: " + anonymous.getParent());
    }
}
 
Example 15
Source Project: netbeans   File: FolderObjCacheTest.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected Level logLevel() {
    return Level.FINEST;
}
 
Example 16
Source Project: netbeans   File: CLIHandlerGrepTest.java    License: Apache License 2.0 4 votes vote down vote up
protected @Override Level logLevel() {
    return Level.FINEST;
}
 
Example 17
public static void main(String[] args) {
    System.setSecurityManager(new SecurityManager());
    Logger anonymous = Logger.getAnonymousLogger();

    final TestHandler handler = new TestHandler();
    final TestFilter filter = new TestFilter();
    final ResourceBundle bundle = ResourceBundle.getBundle(TestBundle.class.getName());
    anonymous.setLevel(Level.FINEST);
    anonymous.addHandler(handler);
    anonymous.setFilter(filter);
    anonymous.setUseParentHandlers(true);
    anonymous.setResourceBundle(bundle);

    if (anonymous.getLevel() != Level.FINEST) {
        throw new RuntimeException("Unexpected level: " + anonymous.getLevel());
    } else {
        System.out.println("Got expected level: " + anonymous.getLevel());
    }
    if (!Arrays.asList(anonymous.getHandlers()).contains(handler)) {
        throw new RuntimeException("Expected handler not found in: "
                + Arrays.asList(anonymous.getHandlers()));
    } else {
        System.out.println("Got expected handler in: " + Arrays.asList(anonymous.getHandlers()));
    }
    if (anonymous.getFilter() != filter) {
        throw new RuntimeException("Unexpected filter: " + anonymous.getFilter());
    } else {
        System.out.println("Got expected filter: " + anonymous.getFilter());
    }
    if (!anonymous.getUseParentHandlers()) {
        throw new RuntimeException("Unexpected flag: " + anonymous.getUseParentHandlers());
    } else {
        System.out.println("Got expected flag: " + anonymous.getUseParentHandlers());
    }
    if (anonymous.getResourceBundle() != bundle) {
        throw new RuntimeException("Unexpected bundle: " + anonymous.getResourceBundle());
    } else {
        System.out.println("Got expected bundle: " + anonymous.getResourceBundle());
    }
    try {
        anonymous.setParent(Logger.getLogger("foo.bar"));
        throw new RuntimeException("Expected SecurityException not raised!");
    } catch (SecurityException x) {
        System.out.println("Got expected exception: " + x);
    }
    if (anonymous.getParent() != Logger.getLogger("")) {
        throw new RuntimeException("Unexpected parent: " + anonymous.getParent());
    } else {
        System.out.println("Got expected parent: " + anonymous.getParent());
    }
}
 
Example 18
@Override
public Level getLevel() {
    return Level.FINEST;
}
 
Example 19
public M4AInfo(InputStream input) throws IOException {
	this(input, Level.FINEST);
}
 
Example 20
Source Project: cougar   File: TraceLogRecord.java    License: Apache License 2.0 4 votes vote down vote up
public TraceLogRecord(String uUID, String msg, Throwable exception) {
	super(null, Level.FINEST, exceptionMessageConstructor(uUID, msg, exception));
	setThrown(exception);
	this.uUID = uUID;
}