Java Code Examples for ch.qos.logback.classic.Level#isGreaterOrEqual()
The following examples show how to use
ch.qos.logback.classic.Level#isGreaterOrEqual() .
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: XodusFileDataWriterLogLevelModificator.java From hivemq-community-edition with Apache License 2.0 | 6 votes |
@Override public FilterReply decide(final Marker marker, final ch.qos.logback.classic.Logger logger, final Level level, final String format, final Object[] params, final Throwable t) { if (level.isGreaterOrEqual(Level.WARN)) { if (logger.getName().equals(fileDataWriterLogger.getName())) { if (format != null) { if (format.startsWith("Can't open directory channel. Log directory fsync won't be performed.")) { if (first.getAndSet(false)) { log.debug("Can't open directory channel. Log directory fsync won't be performed."); } return FilterReply.DENY; } } } } return FilterReply.NEUTRAL; }
Example 2
Source File: LoggerThresholdFilterTest.java From logging-java with Apache License 2.0 | 6 votes |
@Test public void verifyFilteringAllAtWarn() { final LoggerThresholdFilter filter = new LoggerThresholdFilter(); filter.setLevel(WARN); filter.start(); for(Level level : allLevels) { final LoggingEvent evt = new LoggingEvent(); evt.setLevel(level); for(String logger : variousLoggers) { evt.setLoggerName(logger); if(level.isGreaterOrEqual(WARN)) assertEquals(FilterReply.NEUTRAL, filter.decide(evt)); else assertEquals(FilterReply.DENY, filter.decide(evt)); } } }
Example 3
Source File: LogCollector.java From jadx with Apache License 2.0 | 5 votes |
@Override protected void append(ILoggingEvent event) { synchronized (this) { Level level = event.getLevel(); String msg = layout.doLayout(event); store(level, msg); if (listener != null && level.isGreaterOrEqual(listener.getFilterLevel())) { listener.onAppend(msg); } } }
Example 4
Source File: XodusEnvironmentImplLogLevelModificator.java From hivemq-community-edition with Apache License 2.0 | 5 votes |
@Override public FilterReply decide(final Marker marker, final ch.qos.logback.classic.Logger logger, final Level level, final String format, final Object[] params, final Throwable t) { if (level.isGreaterOrEqual(Level.INFO)) { if (logger.getName().equals(environmentalLogger.getName())) { if (format != null) { if (format.contains("transaction(s) not finished")) { logger.trace(marker, format, params); return FilterReply.DENY; } else if (format.contains("Transactions stack traces are not available")) { logger.trace(marker, format, params); return FilterReply.DENY; } } } } if (level.isGreaterOrEqual(Level.ERROR) && t != null && t.getMessage() != null && t instanceof ExodusException) { if (t.getMessage().contains("cleanFile") || t.getMessage().contains("There is no file by address")) { logger.trace(marker, "Xodus background job unable to cleanup stale data just now, trying again later"); return FilterReply.DENY; } } // Let other filters decide return FilterReply.NEUTRAL; }
Example 5
Source File: MessagePanel.java From libreveris with GNU Lesser General Public License v3.0 | 5 votes |
private Color getLevelColor (Level level) { if (level.isGreaterOrEqual(Level.ERROR)) { return Color.RED; } else if (level.isGreaterOrEqual(Level.WARN)) { return Color.BLUE; } else if (level.isGreaterOrEqual(Level.INFO)) { return Color.BLACK; } else { return Color.GRAY; } }
Example 6
Source File: LogPane.java From libreveris with GNU Lesser General Public License v3.0 | 5 votes |
private Color getLevelColor (Level level) { if (level.isGreaterOrEqual(Level.ERROR)) { return Color.RED; } else if (level.isGreaterOrEqual(Level.WARN)) { return Color.BLUE; } else if (level.isGreaterOrEqual(Level.INFO)) { return Color.BLACK; } else { return Color.GRAY; } }
Example 7
Source File: LogbackLoggingConfigurer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
@Override public FilterReply decide(Marker marker, Logger logger, Level level, String format, Object[] params, Throwable t) { Level loggerLevel = logger.getEffectiveLevel(); if (loggerLevel == Level.INFO && (level == Level.INFO || level == Level.WARN) || level == Level.INFO && (loggerLevel == Level.INFO || loggerLevel == Level.WARN)) { // Need to take into account Gradle's LIFECYCLE and QUIET markers. Whether those are set can only be determined // for the global log level, but not for the logger's log level (at least not without walking the logger's // hierarchy, which is something that Logback is designed to avoid for performance reasons). // Hence we base our decision on the global log level. LogLevel eventLevel = LogLevelConverter.toGradleLogLevel(level, marker); return eventLevel.compareTo(currentLevel) >= 0 ? FilterReply.ACCEPT : FilterReply.DENY; } return level.isGreaterOrEqual(loggerLevel) ? FilterReply.ACCEPT : FilterReply.DENY; }
Example 8
Source File: LogbackLoggingConfigurer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
@Override public FilterReply decide(Marker marker, Logger logger, Level level, String format, Object[] params, Throwable t) { Level loggerLevel = logger.getEffectiveLevel(); if (loggerLevel == Level.INFO && (level == Level.INFO || level == Level.WARN) || level == Level.INFO && (loggerLevel == Level.INFO || loggerLevel == Level.WARN)) { // Need to take into account Gradle's LIFECYCLE and QUIET markers. Whether those are set can only be determined // for the global log level, but not for the logger's log level (at least not without walking the logger's // hierarchy, which is something that Logback is designed to avoid for performance reasons). // Hence we base our decision on the global log level. LogLevel eventLevel = LogLevelConverter.toGradleLogLevel(level, marker); return eventLevel.compareTo(currentLevel) >= 0 ? FilterReply.ACCEPT : FilterReply.DENY; } return level.isGreaterOrEqual(loggerLevel) ? FilterReply.ACCEPT : FilterReply.DENY; }
Example 9
Source File: MinMaxFilter.java From baleen with Apache License 2.0 | 5 votes |
/** * Decide whether a given logging event should be accepted or not by this filter (i.e. whether it * falls within the specified levels). * * @param event The logging event being examined * @return Whether the event should be accepted or not */ @Override public FilterReply decide(ILoggingEvent event) { Level level = event.getLevel(); if (level == null) { // We specifically avoid logging here to avoid any circular issues. return FilterReply.DENY; } boolean allow = level.isGreaterOrEqual(min) && max.isGreaterOrEqual(level); return allow ? FilterReply.NEUTRAL : FilterReply.DENY; }
Example 10
Source File: CustomLoggingTurboFilter.java From cf-java-logging-support with Apache License 2.0 | 5 votes |
@Override public FilterReply decide(Marker marker, Logger logger, Level level, String format, Object[] params, Throwable t) { String logLevel = MDC.get(DynamicLogLevelHelper.MDC_DYNAMIC_LOG_LEVEL_KEY); if (logLevel == null) { return FilterReply.NEUTRAL; } if (level.isGreaterOrEqual(Level.toLevel(logLevel))) { return FilterReply.ACCEPT; } return FilterReply.DENY; }
Example 11
Source File: LogPane.java From audiveris with GNU Affero General Public License v3.0 | 5 votes |
private Color getLevelColor (Level level) { if (level.isGreaterOrEqual(Level.ERROR)) { return Color.RED; } else if (level.isGreaterOrEqual(Level.WARN)) { return Color.BLUE; } else if (level.isGreaterOrEqual(Level.INFO)) { return Color.BLACK; } else { return Color.GRAY; } }
Example 12
Source File: LoggerNameAndLevelFilter.java From qpid-broker-j with Apache License 2.0 | 5 votes |
private FilterReply getWildCardLoggerFilterReply(final Level eventLevel) { if (eventLevel.isGreaterOrEqual(_level)) { return FilterReply.ACCEPT; } else { return FilterReply.NEUTRAL; } }
Example 13
Source File: LogbackMetrics.java From micrometer with Apache License 2.0 | 5 votes |
@Override public FilterReply decide(Marker marker, Logger logger, Level level, String format, Object[] params, Throwable t) { // When filter is asked for decision for an isDebugEnabled call or similar test, there is no message (ie format) // and no intention to log anything with this call. We will not increment counters and can return immediately and // avoid the relatively expensive ThreadLocal access below. See also logbacks Logger.callTurboFilters(). if (format == null) { return FilterReply.NEUTRAL; } Boolean ignored = LogbackMetrics.ignoreMetrics.get(); if (ignored != null && ignored) { return FilterReply.NEUTRAL; } // cannot use logger.isEnabledFor(level), as it would cause a StackOverflowError by calling this filter again! if (level.isGreaterOrEqual(logger.getEffectiveLevel())) { switch (level.toInt()) { case Level.ERROR_INT: errorCounter.increment(); break; case Level.WARN_INT: warnCounter.increment(); break; case Level.INFO_INT: infoCounter.increment(); break; case Level.DEBUG_INT: debugCounter.increment(); break; case Level.TRACE_INT: traceCounter.increment(); break; } } return FilterReply.NEUTRAL; }
Example 14
Source File: LogbackLoggingConfigurer.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
@Override public FilterReply decide(Marker marker, Logger logger, Level level, String format, Object[] params, Throwable t) { Level loggerLevel = logger.getEffectiveLevel(); if (loggerLevel == Level.INFO && (level == Level.INFO || level == Level.WARN) || level == Level.INFO && (loggerLevel == Level.INFO || loggerLevel == Level.WARN)) { // Need to take into account Gradle's LIFECYCLE and QUIET markers. Whether those are set can only be determined // for the global log level, but not for the logger's log level (at least not without walking the logger's // hierarchy, which is something that Logback is designed to avoid for performance reasons). // Hence we base our decision on the global log level. LogLevel eventLevel = LogLevelConverter.toGradleLogLevel(level, marker); return eventLevel.compareTo(currentLevel) >= 0 ? FilterReply.ACCEPT : FilterReply.DENY; } return level.isGreaterOrEqual(loggerLevel) ? FilterReply.ACCEPT : FilterReply.DENY; }
Example 15
Source File: LogbackLoggingConfigurer.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
@Override public FilterReply decide(Marker marker, Logger logger, Level level, String format, Object[] params, Throwable t) { Level loggerLevel = logger.getEffectiveLevel(); if (loggerLevel == Level.INFO && (level == Level.INFO || level == Level.WARN) || level == Level.INFO && (loggerLevel == Level.INFO || loggerLevel == Level.WARN)) { // Need to take into account Gradle's LIFECYCLE and QUIET markers. Whether those are set can only be determined // for the global log level, but not for the logger's log level (at least not without walking the logger's // hierarchy, which is something that Logback is designed to avoid for performance reasons). // Hence we base our decision on the global log level. LogLevel eventLevel = LogLevelConverter.toGradleLogLevel(level, marker); return eventLevel.compareTo(currentLevel) >= 0 ? FilterReply.ACCEPT : FilterReply.DENY; } return level.isGreaterOrEqual(loggerLevel) ? FilterReply.ACCEPT : FilterReply.DENY; }
Example 16
Source File: LoggerNameAndLevelFilter.java From qpid-broker-j with Apache License 2.0 | 4 votes |
private FilterReply getExactLoggerFilterReply(final Level eventLevel) { return eventLevel.isGreaterOrEqual(_level) ? FilterReply.ACCEPT : FilterReply.DENY; }
Example 17
Source File: LoggerThresholdFilterTest.java From logging-java with Apache License 2.0 | 4 votes |
@Test public void filterSpotifyAtInfoOthersAtWarn() { List<Filter<ILoggingEvent>> filters = new ArrayList<Filter<ILoggingEvent>>(); LoggerThresholdFilter filter = new LoggerThresholdFilter(); filter.setLogger(spotifyLog); filter.setLevel(INFO); filter.start(); filters.add(filter); filter = new LoggerThresholdFilter(); filter.setExceptLogger(spotifyLog); filter.setLevel(WARN); filter.start(); filters.add(filter); for(Level level : allLevels) { final LoggingEvent evt = new LoggingEvent(); evt.setLevel(level); for(String logger : variousLoggers) { evt.setLoggerName(logger); FilterReply expected; FilterReply actual = FilterReply.NEUTRAL; if(spotifyLoggers.contains(logger)) { if(level.isGreaterOrEqual(INFO)) expected = FilterReply.NEUTRAL; else expected = FilterReply.DENY; } else { if(level.isGreaterOrEqual(WARN)) expected = FilterReply.NEUTRAL; else expected = FilterReply.DENY; } for(Filter<ILoggingEvent> logFilter : filters) { FilterReply nextReply = logFilter.decide(evt); actual = andFilterReplies(actual, nextReply); } assertEquals(String.format("Logger: %s, Level: %s", logger, level.toString()), expected, actual); } } }