Repository: nifi Updated Branches: refs/heads/master 457df93dd -> a7bf683a0
NIFI-79 - Introduces the ability to set Bulletin Level to NONE Project: http://git-wip-us.apache.org/repos/asf/nifi/repo Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/a7bf683a Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/a7bf683a Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/a7bf683a Branch: refs/heads/master Commit: a7bf683a0da932ba70210878321d75999dfa8c0b Parents: 457df93 Author: Andre F de Miranda <[email protected]> Authored: Sat Mar 25 09:47:42 2017 +1100 Committer: Matt Gilman <[email protected]> Committed: Thu Mar 30 08:54:24 2017 -0400 ---------------------------------------------------------------------- .../java/org/apache/nifi/logging/LogLevel.java | 3 +- .../repository/StandardLogRepository.java | 32 +++++++++++--------- .../src/main/resources/FlowConfiguration.xsd | 1 + .../js/nf/canvas/nf-processor-configuration.js | 3 ++ 4 files changed, 23 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/nifi/blob/a7bf683a/nifi-api/src/main/java/org/apache/nifi/logging/LogLevel.java ---------------------------------------------------------------------- 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 0c9b64b..c063bf8 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; } http://git-wip-us.apache.org/repos/asf/nifi/blob/a7bf683a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/logging/repository/StandardLogRepository.java ---------------------------------------------------------------------- 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 8baf04a..2d10d82 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,23 +16,22 @@ */ package org.apache.nifi.logging.repository; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -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; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantReadWriteLock; + 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<LogObserver> 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<LogObserver> 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 { http://git-wip-us.apache.org/repos/asf/nifi/blob/a7bf683a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/resources/FlowConfiguration.xsd ---------------------------------------------------------------------- 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 6bba92c..8cf2ad8 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 @@ <xs:enumeration value="WARN"></xs:enumeration> <xs:enumeration value="ERROR"></xs:enumeration> <xs:enumeration value="FATAL"></xs:enumeration> + <xs:enumeration value="NONE"></xs:enumeration> </xs:restriction> </xs:simpleType> http://git-wip-us.apache.org/repos/asf/nifi/blob/a7bf683a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-processor-configuration.js ---------------------------------------------------------------------- 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 1a26f5a..90667f0 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' }] });
