diff --git a/nifi-api/src/main/java/org/apache/nifi/logging/LogLevel.java b/nifi-api/src/main/java/org/apache/nifi/logging/LogLevel.java index 0c9b64b806..c063bf8e54 100644 --- a/nifi-api/src/main/java/org/apache/nifi/logging/LogLevel.java +++ b/nifi-api/src/main/java/org/apache/nifi/logging/LogLevel.java @@ -23,5 +23,6 @@ public enum LogLevel { INFO, WARN, ERROR, - FATAL; + FATAL, + NONE; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/logging/repository/StandardLogRepository.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/logging/repository/StandardLogRepository.java index 8baf04aca0..2d10d820ac 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/logging/repository/StandardLogRepository.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/logging/repository/StandardLogRepository.java @@ -16,6 +16,15 @@ */ package org.apache.nifi.logging.repository; +import org.apache.nifi.logging.ComponentLog; +import org.apache.nifi.logging.LogLevel; +import org.apache.nifi.logging.LogMessage; +import org.apache.nifi.logging.LogObserver; +import org.apache.nifi.logging.LogRepository; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.helpers.MessageFormatter; + import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -23,16 +32,6 @@ import java.util.Map; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantReadWriteLock; -import org.apache.nifi.logging.ComponentLog; -import org.apache.nifi.logging.LogLevel; -import org.apache.nifi.logging.LogMessage; -import org.apache.nifi.logging.LogObserver; -import org.apache.nifi.logging.LogRepository; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.slf4j.helpers.MessageFormatter; - public class StandardLogRepository implements LogRepository { public static final int DEFAULT_MAX_CAPACITY_PER_LEVEL = 10; @@ -118,8 +117,8 @@ public class StandardLogRepository implements LogRepository { } } - // at this point, the observer should have been found - throw new IllegalStateException("The specified observer identifier does not exist."); + // at this point, the LogLevel must be NONE since we don't register observers for NONE + return LogLevel.NONE; } finally { readLock.unlock(); } @@ -136,12 +135,15 @@ public class StandardLogRepository implements LogRepository { final LogLevel[] allLevels = LogLevel.values(); for (int i = minimumLevel.ordinal(); i < allLevels.length; i++) { - Collection collection = observers.get(allLevels[i]); - if (collection == null) { - collection = new ArrayList<>(); - observers.put(allLevels[i], collection); + // no need to register an observer for NONE since that level will never be logged to by a component + if (i != LogLevel.NONE.ordinal()) { + Collection collection = observers.get(allLevels[i]); + if (collection == null) { + collection = new ArrayList<>(); + observers.put(allLevels[i], collection); + } + collection.add(observer); } - collection.add(observer); } observerLookup.put(observerIdentifier, observer); } finally { diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/resources/FlowConfiguration.xsd b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/resources/FlowConfiguration.xsd index 6bba92c644..8cf2ad87a7 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/resources/FlowConfiguration.xsd +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/resources/FlowConfiguration.xsd @@ -345,6 +345,7 @@ + diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-processor-configuration.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-processor-configuration.js index 1a26f5af03..90667f00c7 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-processor-configuration.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-processor-configuration.js @@ -590,6 +590,9 @@ }, { text: 'ERROR', value: 'ERROR' + }, { + text: 'NONE', + value: 'NONE' }] });