java.util.logging.Level#intValue ( )源码实例Demo

下面列出了java.util.logging.Level#intValue ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

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);
}
 
源代码2 项目: vespa   文件: OsgiLogHandler.java
public static int toServiceLevel(Level level) {
    int val = level.intValue();
    if (val >= Level.SEVERE.intValue()) {
        return LogService.LOG_ERROR;
    }
    if (val >= Level.WARNING.intValue()) {
        return LogService.LOG_WARNING;
    }
    if (val >= Level.INFO.intValue()) {
        return LogService.LOG_INFO;
    }
    // Level.CONFIG
    // Level.FINE
    // Level.FINER
    // Level.FINEST
    return LogService.LOG_DEBUG;
}
 
源代码3 项目: org.openntf.domino   文件: LogFilterHandler.java
private void setUpMyLevel() {
	Level l = _myConfigLFH._defaultLevel;
	for (LogConfig.L_LogFilterHandler.L_LogFilterConfigEntry fce : _myConfigLFH._logFCEList) {
		if (fce._level.intValue() < l.intValue()) {
			l = fce._level;
		}
	}
	setLevel(l);
}
 
源代码4 项目: openjdk-8   文件: TestIsLoggable.java
@Override
public boolean isLoggable(Level level) {
    final Level threadLevel = threadMap.get(Thread.currentThread().getId());
    if (threadLevel == null) return super.isLoggable(level);
    final int levelValue = threadLevel.intValue();
    final int offValue = Level.OFF.intValue();
    if (level.intValue() < levelValue || levelValue == offValue) {
        return false;
    }
    return true;
}
 
源代码5 项目: jdk8u_jdk   文件: Log.java
private LogStreamLog(LogStream stream, Level level) {
    if ((stream != null) && (level != null)) {
        /* if the stream or level is null, don't log any
         * messages
         */
        levelValue = level.intValue();
    }
    this.stream = stream;
}
 
源代码6 项目: selenium   文件: LogLevelMapping.java
/**
 * Normalizes the given level to one of those supported by Selenium.
 *
 * @param level log level to normalize
 * @return the selenium supported corresponding log level
 */
public static Level normalize(Level level) {
  if (levelMap.containsKey(level.intValue())) {
    return levelMap.get(level.intValue());
  } else if (level.intValue() >= Level.SEVERE.intValue()) {
    return Level.SEVERE;
  } else if (level.intValue() >= Level.WARNING.intValue()) {
    return Level.WARNING;
  } else if (level.intValue() >= Level.INFO.intValue()) {
    return Level.INFO;
  } else {
    return Level.FINE;
  }
}
 
源代码7 项目: netbeans   文件: CustomizedLog.java
public static void enableInstances(Logger log, String msg, Level level) {
    if (log == null) {
        log = Logger.getLogger("TIMER"); // NOI18N
    }

    log.addHandler(new InstancesHandler(msg, level,2));

    if (log.getLevel() == null || log.getLevel().intValue() > level.intValue()) {
        log.setLevel(level);
    }       
}
 
源代码8 项目: hottub   文件: Log.java
private LogStreamLog(LogStream stream, Level level) {
    if ((stream != null) && (level != null)) {
        /* if the stream or level is null, don't log any
         * messages
         */
        levelValue = level.intValue();
    }
    this.stream = stream;
}
 
源代码9 项目: openjdk-jdk9   文件: Log.java
private LogStreamLog(LogStream stream, Level level) {
    if ((stream != null) && (level != null)) {
        /* if the stream or level is null, don't log any
         * messages
         */
        levelValue = level.intValue();
    }
    this.stream = stream;
}
 
源代码10 项目: otroslogviewer   文件: LevelLowerAcceptCondition.java
public LevelLowerAcceptCondition(Level level) {
  super();
  this.level = level;
  levelIntValue = level.intValue();
  this.name = String.format("Level <%s", level.getName());
  this.description = String.format("Level of log event is lower than %s", level.getName());
  createIcon();
}
 
源代码11 项目: unleash-maven-plugin   文件: JavaLoggerAdapter.java
private boolean isError(Level level) {
  int value = level.intValue();
  return value <= Level.SEVERE.intValue() && value > Level.WARNING.intValue();
}
 
源代码12 项目: sis   文件: Logging.java
/**
 * Implementation of {@link #unexpectedException(Logger, Class, String, Throwable)}.
 *
 * @param  logger  where to log the error, or {@code null} for inferring a default value from other arguments.
 * @param  classe  the fully qualified class name where the error occurred, or {@code null} for inferring a default value from other arguments.
 * @param  method  the method where the error occurred, or {@code null} for inferring a default value from other arguments.
 * @param  error   the error, or {@code null} if none.
 * @param  level   the logging level.
 * @return {@code true} if the error has been logged, or {@code false} if the given {@code error}
 *         was null or if the logger does not log anything at the specified level.
 */
private static boolean unexpectedException(Logger logger, String classe, String method,
                                           final Throwable error, final Level level)
{
    /*
     * Checks if loggable, inferring the logger from the classe name if needed.
     */
    if (error == null) {
        return false;
    }
    if (logger == null && classe != null) {
        final int separator = classe.lastIndexOf('.');
        final String paquet = (separator >= 1) ? classe.substring(0, separator-1) : "";
        logger = getLogger(paquet);
    }
    if (logger != null && !logger.isLoggable(level)) {
        return false;
    }
    /*
     * The message is fetched using Exception.getMessage() instead than getLocalizedMessage()
     * because in a client-server architecture, we want the locale on the server-side instead
     * than the locale on the client side. See LocalizedException policy.
     */
    final StringBuilder buffer = new StringBuilder(256).append(Classes.getShortClassName(error));
    String message = error.getMessage();        // Targeted to system administrators (see above).
    if (message != null) {
        buffer.append(": ").append(message);
    }
    message = buffer.toString();
    message = Exceptions.formatChainedMessages(null, message, error);
    final LogRecord record = new LogRecord(level, message);
    if (level.intValue() >= LEVEL_THRESHOLD_FOR_STACKTRACE) {
        record.setThrown(error);
    }
    if (logger == null || classe == null || method == null) {
        logger = inferCaller(logger, classe, method, error.getStackTrace(), record);
    } else {
        record.setSourceClassName(classe);
        record.setSourceMethodName(method);
    }
    record.setLoggerName(logger.getName());
    logger.log(record);
    return true;
}
 
源代码13 项目: yql-plus   文件: LoggingTracer.java
private void log(Level level, String message, Object... args) {
    if (level.intValue() >= logThreshold) {
        log.add(new StringEntry(id, ticker.read(), level, message, args));
    }
}
 
源代码14 项目: netbeans   文件: Log.java
/** Starts to listen on given log and collect parameters of messages that
 * were send to it. This is supposed to be called at the beginning of a test,
 * to get messages from the programs that use 
 * <a href="http://wiki.netbeans.org/wiki/view/FitnessViaTimersCounters">timers/counters</a>
 * infrastructure. At the end one should call {@link #assertInstances}.
 * 
 * 
 * @param log logger to listen on, if null, it uses the standard timers/counters one
 * @param msg name of messages to collect, if null, all messages will be recorded
 * @param level level of messages to record
 * @since 1.44
 */
public static void enableInstances(Logger log, String msg, Level level) {
    if (log == null) {
        log = Logger.getLogger("TIMER"); // NOI18N
    }
    
    log.addHandler(new InstancesHandler(msg, level));
    
    if (log.getLevel() == null || log.getLevel().intValue() > level.intValue()) {
        log.setLevel(level);
    }
}
 
源代码15 项目: GreasySpoon   文件: Log.java
/**
 * Store a message in SERVER log
 * @param level Message Level
 * @param message Message content
 */
public final static synchronized void error(Level level, String message) {
	if (!errorEnabled || level.intValue()<loglevel.intValue()) return;
	logger.store(ERROR, level, new StringBuilder(message));
}
 
源代码16 项目: GreasySpoon   文件: Log.java
/**
 * Store a message in SERVICE log
 * @param level Message Level
 * @param message Message content
 */
public final static synchronized void service(Level level, String message) {
	if (!serviceEnabled || level.intValue()<loglevel.intValue()) return;
	logger.store(SERVICE, level, new StringBuilder(message));
}
 
源代码17 项目: openjdk-8   文件: DebugLogger.java
/**
 * Check if the logger is above of the level of detail given
 * @see java.util.logging.Level
 *
 * @param level logging level
 * @return true if level is above the given one
 */
public boolean levelAbove(final Level level) {
    return getLevel().intValue() > level.intValue();
}
 
源代码18 项目: jdk8u60   文件: DebugLogger.java
/**
 * Check if the logger is above or equal to the level
 * of detail given
 * @see java.util.logging.Level
 *
 * The higher the level, the more severe the warning
 *
 * @param level logging level
 * @return true if level is above the given one
 */
public boolean levelCoarserThanOrEqual(final Level level) {
    return getLevel().intValue() >= level.intValue();
}
 
源代码19 项目: otroslogviewer   文件: LevelInequalityRule.java
/**
 * Create new instance.
 *
 * @param level comparison level.
 */
public GreaterThanEqualsRule(final Level level) {
  super();
  newLevelInt = level.intValue();
}
 
源代码20 项目: swellrt   文件: ExceptionLogHandler.java
/**
 * Constructs an ExceptionLogHandler that throws a runtime exception at and above the specified
 * log level.
 *
 * @param fatalLevel the minimum log level for which to throw an exception.
 */
public ExceptionLogHandler(Level fatalLevel) {
  this.fatalLevel = fatalLevel.intValue();
}