Java Code Examples for ch.qos.logback.classic.Level#TRACE_INT
The following examples show how to use
ch.qos.logback.classic.Level#TRACE_INT .
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: LogLevelConverter.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
/** * Maps a Logback log level and optional marker to a Gradle log level. * Returns null if there is no equivalent Gradle log level (such as for TRACE). */ @Nullable public static LogLevel toGradleLogLevel(Level level, @Nullable Marker marker) { switch(level.toInt()) { case Level.TRACE_INT: return null; case Level.DEBUG_INT: return LogLevel.DEBUG; case Level.INFO_INT: if (marker == Logging.LIFECYCLE) { return LogLevel.LIFECYCLE; } if (marker == Logging.QUIET) { return LogLevel.QUIET; } return LogLevel.INFO; case Level.WARN_INT: return LogLevel.WARN; case Level.ERROR_INT: return LogLevel.ERROR; default: throw new IllegalArgumentException("Don't know how to map Logback log level '" + level + "' to a Gradle log level"); } }
Example 2
Source File: LogLevelConverter.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
/** * Maps a Logback log level and optional marker to a Gradle log level. * Returns null if there is no equivalent Gradle log level (such as for TRACE). */ @Nullable public static LogLevel toGradleLogLevel(Level level, @Nullable Marker marker) { switch(level.toInt()) { case Level.TRACE_INT: return null; case Level.DEBUG_INT: return LogLevel.DEBUG; case Level.INFO_INT: if (marker == Logging.LIFECYCLE) { return LogLevel.LIFECYCLE; } if (marker == Logging.QUIET) { return LogLevel.QUIET; } return LogLevel.INFO; case Level.WARN_INT: return LogLevel.WARN; case Level.ERROR_INT: return LogLevel.ERROR; default: throw new IllegalArgumentException("Don't know how to map Logback log level '" + level + "' to a Gradle log level"); } }
Example 3
Source File: LogbackLevels.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
/** * Convert a Logback {@link Level} into a {@link LoggerLevel}. */ public static LoggerLevel convert(final Level level) { switch (level.toInt()) { case Level.ERROR_INT: return LoggerLevel.ERROR; case Level.WARN_INT: return LoggerLevel.WARN; case Level.INFO_INT: return LoggerLevel.INFO; case Level.DEBUG_INT: return LoggerLevel.DEBUG; case Level.OFF_INT: return LoggerLevel.OFF; case Level.TRACE_INT: default: return LoggerLevel.TRACE; } }
Example 4
Source File: LogLevelConverter.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
/** * Maps a Logback log level and optional marker to a Gradle log level. * Returns null if there is no equivalent Gradle log level (such as for TRACE). */ @Nullable public static LogLevel toGradleLogLevel(Level level, @Nullable Marker marker) { switch(level.toInt()) { case Level.TRACE_INT: return null; case Level.DEBUG_INT: return LogLevel.DEBUG; case Level.INFO_INT: if (marker == Logging.LIFECYCLE) { return LogLevel.LIFECYCLE; } if (marker == Logging.QUIET) { return LogLevel.QUIET; } return LogLevel.INFO; case Level.WARN_INT: return LogLevel.WARN; case Level.ERROR_INT: return LogLevel.ERROR; default: throw new IllegalArgumentException("Don't know how to map Logback log level '" + level + "' to a Gradle log level"); } }
Example 5
Source File: LogLevelConverter.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
/** * Maps a Logback log level and optional marker to a Gradle log level. * Returns null if there is no equivalent Gradle log level (such as for TRACE). */ @Nullable public static LogLevel toGradleLogLevel(Level level, @Nullable Marker marker) { switch(level.toInt()) { case Level.TRACE_INT: return null; case Level.DEBUG_INT: return LogLevel.DEBUG; case Level.INFO_INT: if (marker == Logging.LIFECYCLE) { return LogLevel.LIFECYCLE; } if (marker == Logging.QUIET) { return LogLevel.QUIET; } return LogLevel.INFO; case Level.WARN_INT: return LogLevel.WARN; case Level.ERROR_INT: return LogLevel.ERROR; default: throw new IllegalArgumentException("Don't know how to map Logback log level '" + level + "' to a Gradle log level"); } }
Example 6
Source File: CollectorLogbackAppender.java From glowroot with Apache License 2.0 | 6 votes |
private static LogEvent.Level toProto(Level level) { switch (level.toInt()) { case Level.TRACE_INT: return LogEvent.Level.TRACE; case Level.DEBUG_INT: return LogEvent.Level.DEBUG; case Level.INFO_INT: return LogEvent.Level.INFO; case Level.WARN_INT: return LogEvent.Level.WARN; case Level.ERROR_INT: return LogEvent.Level.ERROR; default: // do not log (could end up in recursive loop) return LogEvent.Level.NONE; } }
Example 7
Source File: InstrumentedAppender.java From client_java with Apache License 2.0 | 6 votes |
@Override protected void append(ILoggingEvent event) { switch (event.getLevel().toInt()) { case Level.TRACE_INT: TRACE_LABEL.inc(); break; case Level.DEBUG_INT: DEBUG_LABEL.inc(); break; case Level.INFO_INT: INFO_LABEL.inc(); break; case Level.WARN_INT: WARN_LABEL.inc(); break; case Level.ERROR_INT: ERROR_LABEL.inc(); break; default: break; } }
Example 8
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 9
Source File: CustomLogLevelJsonProvider.java From ja-micro with Apache License 2.0 | 5 votes |
@Override public void writeTo(JsonGenerator generator, ILoggingEvent event) throws IOException { String level; switch (event.getLevel().toInt()) { case Level.ERROR_INT: level = "error"; break; case Level.WARN_INT: level = "warning"; break; case Level.INFO_INT: level = "info"; break; case Level.DEBUG_INT: level = "debug"; break; case Level.TRACE_INT: level = "trace"; break; case Level.ALL_INT: level = "all"; break; case Level.OFF_INT: level = "off"; break; default: level = "???"; } JsonWritingUtils.writeStringField( generator, getFieldName(), level); }
Example 10
Source File: SystemdJournalAppender.java From logback-journal with Apache License 2.0 | 5 votes |
private int levelToInt(Level l) { switch (l.toInt()) { case Level.TRACE_INT: case Level.DEBUG_INT: return 7; case Level.INFO_INT: return 6; case Level.WARN_INT: return 4; case Level.ERROR_INT: return 3; default: throw new IllegalArgumentException("Unknown level value: " + l); } }
Example 11
Source File: Cli.java From bazel-tools with Apache License 2.0 | 4 votes |
@Override protected void append(final ILoggingEvent eventObject) { final Level level = eventObject.getLevel(); final Chalk prefix; switch (level.toInt()) { case Level.ERROR_INT: prefix = ERROR_CHALK; break; case Level.WARN_INT: prefix = WARN_CHALK; break; case Level.INFO_INT: prefix = INFO_CHALK; break; case Level.DEBUG_INT: if (!verbose()) { return; } prefix = DEBUG_CHALK; break; case Level.TRACE_INT: if (!verbose()) { return; } prefix = TRACE_CHALK; break; case Level.OFF_INT: case Level.ALL_INT: default: throw new IllegalArgumentException("Unexpected log level " + level); } System.err.printf( Locale.ROOT, "%s %s: %s%n", toolChalk(), prefix, ansi().render(eventObject.getFormattedMessage())); final IThrowableProxy throwableProxy = eventObject.getThrowableProxy(); if (throwableProxy != null) { for (final String line : Splitter.on('\n') .omitEmptyStrings() .split(ThrowableProxyUtil.asString(throwableProxy))) { System.err.printf(Locale.ROOT, "%s %s: %s%n", toolChalk(), prefix, line); } } }