Java Code Examples for java.util.logging.Level#intValue()
The following examples show how to use
java.util.logging.Level#intValue() .
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
Source File: LevelLowerAcceptCondition.java From otroslogviewer with Apache License 2.0 | 6 votes |
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 2
Source File: OsgiLogHandler.java From vespa with Apache License 2.0 | 6 votes |
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; }
Example 3
Source File: LogFilterHandler.java From org.openntf.domino with Apache License 2.0 | 5 votes |
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); }
Example 4
Source File: TestIsLoggable.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@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; }
Example 5
Source File: Log.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
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; }
Example 6
Source File: LogLevelMapping.java From selenium with Apache License 2.0 | 5 votes |
/** * 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; } }
Example 7
Source File: CustomizedLog.java From netbeans with Apache License 2.0 | 5 votes |
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); } }
Example 8
Source File: Log.java From hottub with GNU General Public License v2.0 | 5 votes |
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; }
Example 9
Source File: LevelLowerAcceptCondition.java From otroslogviewer with Apache License 2.0 | 5 votes |
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(); }
Example 10
Source File: Log.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
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; }
Example 11
Source File: JavaLoggerAdapter.java From unleash-maven-plugin with Eclipse Public License 1.0 | 4 votes |
private boolean isError(Level level) { int value = level.intValue(); return value <= Level.SEVERE.intValue() && value > Level.WARNING.intValue(); }
Example 12
Source File: LoggingTracer.java From yql-plus with Apache License 2.0 | 4 votes |
private void log(Level level, String message, Object... args) { if (level.intValue() >= logThreshold) { log.add(new StringEntry(id, ticker.read(), level, message, args)); } }
Example 13
Source File: Logging.java From sis with Apache License 2.0 | 4 votes |
/** * 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; }
Example 14
Source File: Log.java From netbeans with Apache License 2.0 | 3 votes |
/** 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); } }
Example 15
Source File: DebugLogger.java From jdk8u60 with GNU General Public License v2.0 | 2 votes |
/** * 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(); }
Example 16
Source File: LevelInequalityRule.java From otroslogviewer with Apache License 2.0 | 2 votes |
/** * Create new instance. * * @param level comparison level. */ public GreaterThanEqualsRule(final Level level) { super(); newLevelInt = level.intValue(); }
Example 17
Source File: DebugLogger.java From openjdk-8 with GNU General Public License v2.0 | 2 votes |
/** * 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(); }
Example 18
Source File: ExceptionLogHandler.java From swellrt with Apache License 2.0 | 2 votes |
/** * 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(); }
Example 19
Source File: Log.java From GreasySpoon with GNU Affero General Public License v3.0 | 2 votes |
/** * 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)); }
Example 20
Source File: Log.java From GreasySpoon with GNU Affero General Public License v3.0 | 2 votes |
/** * 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)); }