Java Code Examples for org.apache.logging.log4j.Level#OFF
The following examples show how to use
org.apache.logging.log4j.Level#OFF .
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: LogTypeConverter.java From teku with Apache License 2.0 | 6 votes |
@Override public Level convert(String value) { switch (value.toUpperCase()) { case "OFF": return Level.OFF; case "FATAL": return Level.FATAL; case "WARN": return Level.WARN; case "INFO": return Level.INFO; case "DEBUG": return Level.DEBUG; case "TRACE": return Level.TRACE; case "ALL": return Level.ALL; } throw (new CommandLine.TypeConversionException( "'" + value + "' is not a valid log level. Supported values are [OFF|FATAL|WARN|INFO|DEBUG|TRACE|ALL]")); }
Example 2
Source File: DefaultLogger.java From ymate-platform-v2 with Apache License 2.0 | 6 votes |
public static Level __parseLogLevel(LogLevel level) { switch (level.getLevel()) { case 600: return Level.TRACE; case 500: return Level.DEBUG; case 400: return Level.INFO; case 300: return Level.WARN; case 200: return Level.ERROR; case 100: return Level.FATAL; case 0: return Level.OFF; default: return Level.ALL; } }
Example 3
Source File: SLF4JLogger.java From logging-log4j2 with Apache License 2.0 | 6 votes |
@Override public Level getLevel() { if (logger.isTraceEnabled()) { return Level.TRACE; } if (logger.isDebugEnabled()) { return Level.DEBUG; } if (logger.isInfoEnabled()) { return Level.INFO; } if (logger.isWarnEnabled()) { return Level.WARN; } if (logger.isErrorEnabled()) { return Level.ERROR; } // Option: throw new IllegalStateException("Unknown SLF4JLevel"); // Option: return Level.ALL; return Level.OFF; }
Example 4
Source File: Log4jLogEvent.java From logging-log4j2 with Apache License 2.0 | 6 votes |
private Log4jLogEvent(final String loggerName, final Marker marker, final String loggerFQCN, final Level level, final Message message, final Throwable thrown, final ThrowableProxy thrownProxy, final StringMap contextData, final ThreadContext.ContextStack contextStack, final long threadId, final String threadName, final int threadPriority, final StackTraceElement source, final long nanoTime) { this.loggerName = loggerName; this.marker = marker; this.loggerFqcn = loggerFQCN; this.level = level == null ? Level.OFF : level; // LOG4J2-462, LOG4J2-465 this.message = message; this.thrown = thrown; this.thrownProxy = thrownProxy; this.contextData = contextData == null ? ContextDataFactory.createContextData() : contextData; this.contextStack = contextStack == null ? ThreadContext.EMPTY_STACK : contextStack; this.threadId = threadId; this.threadName = threadName; this.threadPriority = threadPriority; this.source = source; if (message instanceof LoggerNameAwareMessage) { ((LoggerNameAwareMessage) message).setLoggerName(loggerName); } this.nanoTime = nanoTime; }
Example 5
Source File: StatusConfiguration.java From logging-log4j2 with Apache License 2.0 | 5 votes |
/** * Configures and initializes the StatusLogger using the configured options in this instance. */ public void initialize() { if (!this.initialized) { if (this.status == Level.OFF) { this.initialized = true; } else { final boolean configured = configureExistingStatusConsoleListener(); if (!configured) { registerNewStatusConsoleListener(); } migrateSavedLogMessages(); } } }
Example 6
Source File: MutableLogEvent.java From logging-log4j2 with Apache License 2.0 | 5 votes |
@Override public Level getLevel() { if (level == null) { level = Level.OFF; // LOG4J2-462, LOG4J2-465 } return level; }
Example 7
Source File: RingBufferLogEvent.java From logging-log4j2 with Apache License 2.0 | 5 votes |
@Override public Level getLevel() { if (level == null) { level = Level.OFF; // LOG4J2-462, LOG4J2-465 } return level; }
Example 8
Source File: DiscardingAsyncQueueFullPolicyTest.java From logging-log4j2 with Apache License 2.0 | 5 votes |
@Test public void testGetRouteEnqueuesIfThresholdCapacityReachedButLevelMoreSpecificThanThreshold() throws Exception { final DiscardingAsyncQueueFullPolicy router = new DiscardingAsyncQueueFullPolicy(Level.WARN); for (final Level level : new Level[] {Level.ERROR, Level.FATAL, Level.OFF}) { assertEquals(level.name(), EventRoute.SYNCHRONOUS, router.getRoute(currentThreadId(), level)); assertEquals(level.name(), EventRoute.ENQUEUE, router.getRoute(otherThreadId(), level)); assertEquals(level.name(), EventRoute.SYNCHRONOUS, router.getRoute(currentThreadId(), level)); assertEquals(level.name(), EventRoute.ENQUEUE, router.getRoute(otherThreadId(), level)); } }
Example 9
Source File: DiscardingAsyncQueueFullPolicyTest.java From logging-log4j2 with Apache License 2.0 | 5 votes |
@Test public void testGetRouteEnqueueIfOtherThreadQueueFullAndLevelMoreSpecificThanThreshold() throws Exception { final DiscardingAsyncQueueFullPolicy router = new DiscardingAsyncQueueFullPolicy(Level.WARN); for (final Level level : new Level[] {Level.ERROR, Level.FATAL, Level.OFF}) { assertEquals(level.name(), EventRoute.ENQUEUE, router.getRoute(otherThreadId(), level)); } }
Example 10
Source File: DiscardingAsyncQueueFullPolicyTest.java From logging-log4j2 with Apache License 2.0 | 5 votes |
@Test public void testGetRouteSynchronousIfCurrentThreadQueueFullAndLevelMoreSpecificThanThreshold() throws Exception { final DiscardingAsyncQueueFullPolicy router = new DiscardingAsyncQueueFullPolicy(Level.WARN); for (final Level level : new Level[] {Level.ERROR, Level.FATAL, Level.OFF}) { assertEquals(level.name(), EventRoute.SYNCHRONOUS, router.getRoute(currentThreadId(), level)); } }
Example 11
Source File: LoggingConfigurator.java From teku with Apache License 2.0 | 4 votes |
private static LoggerConfig setUpEventsLogger(final Appender appender) { final Level eventsLogLevel = INCLUDE_EVENTS ? ROOT_LOG_LEVEL : Level.OFF; final LoggerConfig logger = new LoggerConfig(EVENT_LOGGER_NAME, eventsLogLevel, true); logger.addAppender(appender, eventsLogLevel, null); return logger; }
Example 12
Source File: Log4j2LoggingHelper.java From herd with Apache License 2.0 | 4 votes |
/** * Converts a generic log level to a Log4J specific log level. * * @param logLevel the generic log level. * * @return the Log4J specific log level. */ private Level genericLogLevelToLog4j(LogLevel logLevel) { Level level = Level.ALL; if (logLevel.equals(LogLevel.OFF)) { level = Level.OFF; } else if (logLevel.equals(LogLevel.FATAL)) { level = Level.FATAL; } else if (logLevel.equals(LogLevel.ERROR)) { level = Level.ERROR; } else if (logLevel.equals(LogLevel.WARN)) { level = Level.WARN; } else if (logLevel.equals(LogLevel.INFO)) { level = Level.INFO; } else if (logLevel.equals(LogLevel.DEBUG)) { level = Level.DEBUG; } else if (logLevel.equals(LogLevel.TRACE)) { level = Level.TRACE; } else if (logLevel.equals(LogLevel.ALL)) { level = Level.ALL; } else { LOGGER.warn("Unsupported log level encountered: " + logLevel.toString() + ". Using ALL."); } return level; }