Repository: nifi
Updated Branches:
  refs/heads/master 3157b00a7 -> 182e2c6e9


NIFI-4708 This closes #2389. Fixes encrypt-config log4j configuration

Signed-off-by: joewitt <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/182e2c6e
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/182e2c6e
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/182e2c6e

Branch: refs/heads/master
Commit: 182e2c6e94a4b1f225ff1902f048e9cb5c3c400c
Parents: 3157b00
Author: Kevin Doran <[email protected]>
Authored: Mon Jan 8 22:28:08 2018 -0500
Committer: joewitt <[email protected]>
Committed: Mon Jan 8 21:31:57 2018 -0700

----------------------------------------------------------------------
 .../nifi/toolkit/encryptconfig/EncryptConfigLogger.groovy       | 5 ++++-
 .../src/test/resources/log4j.properties                         | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/182e2c6e/nifi-toolkit/nifi-toolkit-encrypt-config/src/main/groovy/org/apache/nifi/toolkit/encryptconfig/EncryptConfigLogger.groovy
----------------------------------------------------------------------
diff --git 
a/nifi-toolkit/nifi-toolkit-encrypt-config/src/main/groovy/org/apache/nifi/toolkit/encryptconfig/EncryptConfigLogger.groovy
 
b/nifi-toolkit/nifi-toolkit-encrypt-config/src/main/groovy/org/apache/nifi/toolkit/encryptconfig/EncryptConfigLogger.groovy
index 07c9577..98a0944 100644
--- 
a/nifi-toolkit/nifi-toolkit-encrypt-config/src/main/groovy/org/apache/nifi/toolkit/encryptconfig/EncryptConfigLogger.groovy
+++ 
b/nifi-toolkit/nifi-toolkit-encrypt-config/src/main/groovy/org/apache/nifi/toolkit/encryptconfig/EncryptConfigLogger.groovy
@@ -37,7 +37,7 @@ class EncryptConfigLogger {
     static configureLogger(boolean verboseEnabled) {
 
         Properties log4jProps = null
-        URL log4jPropsPath = this.getClass().getResource("log4j.properties")
+        URL log4jPropsPath = 
EncryptConfigLogger.class.getResource("/log4j.properties")
         if (log4jPropsPath) {
             try {
                 log4jPropsPath.withReader { reader ->
@@ -53,6 +53,9 @@ class EncryptConfigLogger {
             log4jProps = defaultProperties()
         }
 
+        // For encrypt-config, log output should go to System.err as 
System.out is used for tool output in decrypt mode
+        log4jProps.put("log4j.appender.console.Target", "System.err")
+
         if (verboseEnabled) {
             // Override the log level for this package. For this to work as 
intended, this class must belong
             // to the same package (or a parent package) of all the 
encrypt-config classes

http://git-wip-us.apache.org/repos/asf/nifi/blob/182e2c6e/nifi-toolkit/nifi-toolkit-encrypt-config/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git 
a/nifi-toolkit/nifi-toolkit-encrypt-config/src/test/resources/log4j.properties 
b/nifi-toolkit/nifi-toolkit-encrypt-config/src/test/resources/log4j.properties
index aa42a32..d68cca0 100644
--- 
a/nifi-toolkit/nifi-toolkit-encrypt-config/src/test/resources/log4j.properties
+++ 
b/nifi-toolkit/nifi-toolkit-encrypt-config/src/test/resources/log4j.properties
@@ -18,6 +18,7 @@
 log4j.rootLogger=DEBUG,console,test
 
 log4j.appender.console=org.apache.log4j.ConsoleAppender
+log4j.appender.console.Target=System.err
 log4j.appender.console.layout=org.apache.log4j.PatternLayout
 log4j.appender.console.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p 
%c{2}: %m%n
 

Reply via email to