Java Code Examples for ch.qos.logback.classic.Level#DEBUG
The following examples show how to use
ch.qos.logback.classic.Level#DEBUG .
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: LoggingRule.java From datakernel with Apache License 2.0 | 6 votes |
private Level getAdaptedLevel(org.slf4j.event.Level level) { switch (level) { case ERROR: return Level.ERROR; case WARN: return Level.WARN; case INFO: return Level.INFO; case DEBUG: return Level.DEBUG; case TRACE: return Level.TRACE; default: return DEFAULT_LOGGING_LEVEL; } }
Example 2
Source File: LogLevelConverter.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
public static Level toLogbackLevel(LogLevel level) { switch (level) { case DEBUG: return Level.DEBUG; case INFO: case LIFECYCLE: case QUIET: return Level.INFO; case WARN: return Level.WARN; case ERROR: return Level.ERROR; default: throw new IllegalArgumentException("Don't know how to map Gradle log level '" + level + "' to a Logback log level"); } }
Example 3
Source File: SLF4JLoggerIT.java From snowflake-jdbc with Apache License 2.0 | 6 votes |
/** * Converts log levels in {@link LogLevel} to appropriate levels in * {@link Level}. */ private Level toLogBackLevel(LogLevel level) { switch (level) { case ERROR: return Level.ERROR; case WARNING: return Level.WARN; case INFO: return Level.INFO; case DEBUG: return Level.DEBUG; case TRACE: return Level.TRACE; } return Level.TRACE; }
Example 4
Source File: KonkerLoggerAppenderTest.java From konker-platform with Apache License 2.0 | 6 votes |
@Test public void shouldNotCaptureTenantAwareLogWhenEventHasNoContextLogLevel(){ ILoggingEvent logEvent = new LoggingEvent( LOG.getName(), LOG, Level.DEBUG, "Test Message", null, new Object[]{device.toURI()} ); konkerLoggerAppender.append(logEvent); Mockito.verify(konkerLoggerAppender, Mockito.never()) .store(Mockito.any(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString()); }
Example 5
Source File: KonkerLoggerAppenderTest.java From konker-platform with Apache License 2.0 | 6 votes |
@Test public void shouldNotCaptureTenantAwareLogWhenEventHasNoURI(){ ILoggingEvent logEvent = new LoggingEvent( LOG.getName(), LOG, Level.DEBUG, "Test Message", null, new Object[]{device.getLogLevel()} ); konkerLoggerAppender.append(logEvent); Mockito.verify(konkerLoggerAppender, Mockito.never()) .store(Mockito.any(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString()); }
Example 6
Source File: KonkerLoggerAppenderTest.java From konker-platform with Apache License 2.0 | 6 votes |
@Test public void shouldNotCaptureLogTentantAwareLogWhenEventLevelIsDifferentFromDeviceLevel() { ILoggingEvent logEvent = new LoggingEvent( LOG.getName(), LOG, Level.DEBUG, "Test Message", null, new Object[]{device.toURI(), device.getLogLevel()} ); konkerLoggerAppender.append(logEvent); Mockito.verify(konkerLoggerAppender, Mockito.never()) .store(Mockito.any(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString()); }
Example 7
Source File: LoggerOutputStream.java From NationStatesPlusPlus with MIT License | 6 votes |
@Override public synchronized void flush() throws IOException { super.flush(); String record = this.toString(); super.reset(); if (record.length() > 0 && !record.equals(separator) && level != Level.OFF) { if (level == Level.TRACE) log.trace(record); else if (level == Level.DEBUG) log.debug(record); else if (level == Level.INFO) log.info(record); else if (level == Level.WARN) log.warn(record); else if (level == Level.ERROR) log.error(record); } }
Example 8
Source File: SelfCheckHttpServer.java From krpc with Apache License 2.0 | 6 votes |
public Level toLevel(String sArg) { if (sArg == null) { return null; } else if (sArg.equalsIgnoreCase("ALL")) { return Level.ALL; } else if (sArg.equalsIgnoreCase("TRACE")) { return Level.TRACE; } else if (sArg.equalsIgnoreCase("DEBUG")) { return Level.DEBUG; } else if (sArg.equalsIgnoreCase("INFO")) { return Level.INFO; } else if (sArg.equalsIgnoreCase("WARN")) { return Level.WARN; } else if (sArg.equalsIgnoreCase("ERROR")) { return Level.ERROR; } else { return sArg.equalsIgnoreCase("OFF") ? Level.OFF : null; } }
Example 9
Source File: LogbackLoggerSpaceFactory.java From sofa-common-tools with Apache License 2.0 | 6 votes |
private Level toLogbackLevel(AdapterLevel adapterLevel) { if (adapterLevel == null) { throw new IllegalStateException("AdapterLevel is NULL when adapter to logback."); } switch (adapterLevel) { case TRACE: return Level.TRACE; case DEBUG: return Level.DEBUG; case INFO: return Level.INFO; case WARN: return Level.WARN; case ERROR: return Level.ERROR; default: throw new IllegalStateException(adapterLevel + " is unknown when adapter to logback."); } }
Example 10
Source File: CollectorLogbackAppender.java From glowroot with Apache License 2.0 | 6 votes |
@Override protected void append(ILoggingEvent event) { if (inFlush.get()) { return; } if (event.getLevel() == Level.DEBUG && event.getLoggerName().startsWith("io.grpc.")) { return; } if (event.getLoggerName().startsWith("org.glowroot.central.") || event.getLoggerName().startsWith("org.glowroot.ui.")) { // this can happen during integration tests when agent and the central collector are // running in the same JVM (using LocalContainer for agent) return; } LogEvent.Builder builder = LogEvent.newBuilder() .setTimestamp(event.getTimeStamp()) .setLevel(toProto(event.getLevel())) .setLoggerName(event.getLoggerName()) .setMessage(event.getFormattedMessage()); IThrowableProxy throwable = event.getThrowableProxy(); if (throwable != null) { builder.setThrowable(toProto(throwable)); } flush(builder.build()); }
Example 11
Source File: LogLevelConverter.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
public static Level toLogbackLevel(LogLevel level) { switch (level) { case DEBUG: return Level.DEBUG; case INFO: case LIFECYCLE: case QUIET: return Level.INFO; case WARN: return Level.WARN; case ERROR: return Level.ERROR; default: throw new IllegalArgumentException("Don't know how to map Gradle log level '" + level + "' to a Logback log level"); } }
Example 12
Source File: ExpectedExceptionAppender.java From centraldogma with Apache License 2.0 | 5 votes |
@Override public Level getLevel() { if (event.getLevel().levelInt <= Level.DEBUG_INT) { return event.getLevel(); } return Level.DEBUG; }
Example 13
Source File: LoggingUtils.java From heat with Apache License 2.0 | 5 votes |
/** * This method sets the log level (logback). */ public void setLogLevel() { logLevel = System.getProperty("logLevel", LOG_LEVEL_INFO); Logger root = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME); Level logLevelSetting; switch (logLevel.toLowerCase()) { case LOG_LEVEL_ERROR: logLevelSetting = Level.ERROR; break; case LOG_LEVEL_WARN: logLevelSetting = Level.WARN; break; case LOG_LEVEL_ALL: logLevelSetting = Level.ALL; break; case LOG_LEVEL_TRACE_LOG: logLevelSetting = Level.TRACE; break; case LOG_LEVEL_INFO: logLevelSetting = Level.INFO; break; case LOG_LEVEL_DEBUG: logLevelSetting = Level.DEBUG; break; default: logLevelSetting = Level.INFO; break; } root.setLevel(logLevelSetting); }
Example 14
Source File: KonkerLogger.java From konker-platform with Apache License 2.0 | 5 votes |
private void localLevelReset() { this.effectiveLevelInt = 10000; if(this.isRootLogger()) { this.level = Level.DEBUG; } else { this.level = null; } }
Example 15
Source File: LogbackLogConfigurator.java From butterfly with MIT License | 5 votes |
private Level getLogbackLogLevel(org.slf4j.event.Level slf4jLevel) { if(slf4jLevel.equals(org.slf4j.event.Level.INFO)) return Level.INFO; if(slf4jLevel.equals(org.slf4j.event.Level.DEBUG)) return Level.DEBUG; if(slf4jLevel.equals(org.slf4j.event.Level.WARN)) return Level.WARN; if(slf4jLevel.equals(org.slf4j.event.Level.ERROR)) return Level.ERROR; throw new IllegalArgumentException("Unknown log level"); }
Example 16
Source File: GelfEncoderTest.java From logback-gelf with GNU Lesser General Public License v2.1 | 5 votes |
public static LoggingEvent simpleLoggingEvent(final Logger logger, final Throwable e) { return new LoggingEvent( LOGGER_NAME, logger, Level.DEBUG, "message {}", e, new Object[]{1}); }
Example 17
Source File: LoggingUtil.java From fredbet with Creative Commons Attribution Share Alike 4.0 International | 5 votes |
private Level toLevel(LogLevel logLevel) { switch (logLevel) { case DEBUG: return Level.DEBUG; case INFO: return Level.INFO; case WARN: return Level.WARN; default: return Level.ERROR; } }
Example 18
Source File: QpidLoggerTurboFilterTest.java From qpid-broker-j with Apache License 2.0 | 4 votes |
@Test public void testInstallFilterWorksCorrectly() { Logger fooBarLogger = _loggerContext.getLogger("foo.bar"); if(fooBarLogger.isDebugEnabled()) { fail("debug should not be enabled by default"); } if(fooBarLogger.isInfoEnabled()) { fail("info should not be enabled by default"); } final LoggerNameAndLevelFilter allFooInfo = new LoggerNameAndLevelFilter("foo.*", Level.INFO); _turboFilter.filterAdded(allFooInfo); if(!fooBarLogger.isInfoEnabled()) { fail("info should be enabled after filter added"); } if(fooBarLogger.isDebugEnabled()) { fail("debug should not be enabled after info enabled"); } final LoggerNameAndLevelFilter fooBarDebugFilter = new LoggerNameAndLevelFilter("foo.bar", Level.DEBUG); _turboFilter.filterAdded(fooBarDebugFilter); if(!fooBarLogger.isDebugEnabled()) { fail("debug should now be enabled"); } final Logger fooBazLogger = _loggerContext.getLogger("foo.baz"); if(fooBazLogger.isDebugEnabled()) { fail("debug should not be enabled after for foo.baz"); } _turboFilter.filterRemoved(allFooInfo); if(!fooBarLogger.isInfoEnabled()) { fail("info should be still be enabled fo foo.bar"); } if(fooBazLogger.isInfoEnabled()) { fail("info should not still be enabled fo foo.baz"); } }
Example 19
Source File: NettyLogLevelModifier.java From hivemq-community-edition with Apache License 2.0 | 4 votes |
@Override public FilterReply decide(final Marker marker, final Logger logger, final Level level, final String format, final Object[] params, final Throwable t) { if (format == null || logger == null) { return FilterReply.NEUTRAL; } if (logger.getName() == null) { return FilterReply.NEUTRAL; } if (level == Level.DEBUG) { if (logger.getName().startsWith("io.netty.handler.traffic.")) { return FilterReply.DENY; } else if (logger.getName().contains("io.netty.util.internal.NativeLibraryLoader")) { if (t instanceof UnsatisfiedLinkError) { return FilterReply.DENY; } if (params == null) { logger.trace(marker, format, params); return FilterReply.DENY; } final Object[] paramList = params; for (final Object param : paramList) { if (param instanceof UnsatisfiedLinkError) { return FilterReply.DENY; } } logger.trace(marker, format, params); return FilterReply.DENY; } else if (logger.getName().startsWith("io.netty")) { return traceAndSortOutUnsupportedOperationException(marker, logger, format, params, t); } } else if (level == Level.TRACE) { if (logger.getName().contains("io.netty.channel.nio.NioEventLoop")) { return sortOutUnsupportedOperationException(params, t); } } return FilterReply.NEUTRAL; }
Example 20
Source File: CloudWatchAppenderTest.java From cloudwatch-logback-appender with ISC License | 4 votes |
@Test(timeout = 5000) public void testBasic() throws InterruptedException { CloudWatchAppender appender = new CloudWatchAppender(); AWSLogsClient awsLogClient = createMock(AWSLogsClient.class); appender.setAwsLogsClient(awsLogClient); appender.setMaxBatchSize(1); appender.setRegion("region"); final String logGroup = "pfqoejpfqe"; appender.setLogGroup(logGroup); final String logStream = "pffqjfqjpoqoejpfqe"; appender.setLogStream(logStream); PatternLayout layout = new PatternLayout(); layout.setContext(new LoggerContext()); layout.setPattern("[%thread] %level %logger{20} - %msg%n%xThrowable"); layout.start(); appender.setLayout(layout); LoggingEvent event = new LoggingEvent(); event.setTimeStamp(System.currentTimeMillis()); String loggerName = "name"; event.setLoggerName(loggerName); Level level = Level.DEBUG; event.setLevel(level); String message = "fjpewjfpewjfpewjfepowf"; event.setMessage(message); String threadName = Thread.currentThread().getName(); final String fullMessage = "[" + threadName + "] " + level + " " + loggerName + " - " + message + "\n"; final PutLogEventsResult result = new PutLogEventsResult(); String sequence = "ewopjfewfj"; result.setNextSequenceToken(sequence); expect(awsLogClient.putLogEvents(isA(PutLogEventsRequest.class))).andAnswer(new IAnswer<PutLogEventsResult>() { @Override public PutLogEventsResult answer() { PutLogEventsRequest request = (PutLogEventsRequest) getCurrentArguments()[0]; assertEquals(logGroup, request.getLogGroupName()); assertEquals(logStream, request.getLogStreamName()); List<InputLogEvent> events = request.getLogEvents(); assertEquals(1, events.size()); assertEquals(fullMessage, events.get(0).getMessage()); return result; } }).times(2); awsLogClient.shutdown(); // ===================================== replay(awsLogClient); appender.start(); // for coverage appender.start(); appender.append(event); Thread.sleep(10); appender.append(event); while (appender.getEventsWrittenCount() < 2) { Thread.sleep(10); } appender.stop(); verify(awsLogClient); }