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

Signed-off-by: joewitt <joewitt@apache.org>
This commit is contained in:
Kevin Doran 2018-01-08 22:28:08 -05:00 committed by joewitt
parent 3157b00a7a
commit 182e2c6e94
2 changed files with 5 additions and 1 deletions

View File

@ -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

View File

@ -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