This is an automated email from the ASF dual-hosted git repository.

prasanthj pushed a commit to branch branch-3
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/branch-3 by this push:
     new 05cedd4  HIVE-21235: LLAP: make the name of log4j2 properties file 
configurable (Prasanth Jayachandran reviewed by Ashuotsh Chauhan)
05cedd4 is described below

commit 05cedd4ae7c0dc00292665590726e343ab76f211
Author: Prasanth Jayachandran <prasan...@apache.org>
AuthorDate: Tue Feb 12 00:20:21 2019 -0800

    HIVE-21235: LLAP: make the name of log4j2 properties file configurable 
(Prasanth Jayachandran reviewed by Ashuotsh Chauhan)
---
 llap-server/bin/runLlapDaemon.sh                                   | 7 ++++++-
 .../org/apache/hadoop/hive/llap/daemon/impl/LlapConstants.java     | 1 +
 .../java/org/apache/hadoop/hive/llap/daemon/impl/LlapDaemon.java   | 7 +++++--
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/llap-server/bin/runLlapDaemon.sh b/llap-server/bin/runLlapDaemon.sh
index 1c128c6..ae2621c 100755
--- a/llap-server/bin/runLlapDaemon.sh
+++ b/llap-server/bin/runLlapDaemon.sh
@@ -27,6 +27,7 @@ set -x
 #   LLAP_DAEMON_LOGGER - default is console
 #   LLAP_DAEMON_LOG_DIR - defaults to /tmp
 #   LLAP_DAEMON_TMP_DIR - defaults to /tmp
+#   LLAP_LOG4J2_PROPERTIES_FILE_NAME - defaults to 
llap-daemon-log4j2.properties
 #   LLAP_DAEMON_LOG_FILE - 
 #   LLAP_DAEMON_CONF_DIR
 
@@ -90,6 +91,10 @@ if [ "$LLAP_DAEMON_LOGFILE" = "" ]; then
   LLAP_DAEMON_LOG_FILE='llapdaemon.log'
 fi
 
+if [ "LLAP_LOG4J2_PROPERTIES_FILE_NAME" = "" ]; then
+  LLAP_LOG4J2_PROPERTIES_FILE_NAME='llap-daemon-log4j2.properties'
+fi
+
 if [ "$LLAP_DAEMON_HEAPSIZE" = "" ]; then
   LLAP_DAEMON_HEAPSIZE=4096
 fi
@@ -121,7 +126,7 @@ if [ -n "$LLAP_DAEMON_TMP_DIR" ]; then
   export LLAP_DAEMON_OPTS="${LLAP_DAEMON_OPTS} 
-Djava.io.tmpdir=$LLAP_DAEMON_TMP_DIR"
 fi
 
-LLAP_DAEMON_OPTS="${LLAP_DAEMON_OPTS} 
-Dlog4j.configurationFile=llap-daemon-log4j2.properties"
+LLAP_DAEMON_OPTS="${LLAP_DAEMON_OPTS} 
-Dlog4j.configurationFile=${LLAP_LOG4J2_PROPERTIES_FILE_NAME}"
 LLAP_DAEMON_OPTS="${LLAP_DAEMON_OPTS} 
-Dllap.daemon.log.dir=${LLAP_DAEMON_LOG_DIR}"
 LLAP_DAEMON_OPTS="${LLAP_DAEMON_OPTS} 
-Dllap.daemon.log.file=${LLAP_DAEMON_LOG_FILE}"
 LLAP_DAEMON_OPTS="${LLAP_DAEMON_OPTS} 
-Dllap.daemon.root.logger=${LLAP_DAEMON_LOGGER}"
diff --git 
a/llap-server/src/java/org/apache/hadoop/hive/llap/daemon/impl/LlapConstants.java
 
b/llap-server/src/java/org/apache/hadoop/hive/llap/daemon/impl/LlapConstants.java
index 112173c..b421e0b 100644
--- 
a/llap-server/src/java/org/apache/hadoop/hive/llap/daemon/impl/LlapConstants.java
+++ 
b/llap-server/src/java/org/apache/hadoop/hive/llap/daemon/impl/LlapConstants.java
@@ -19,6 +19,7 @@ import 
org.apache.hadoop.hive.common.classification.InterfaceAudience;
 @InterfaceAudience.Private
 public class LlapConstants {
   public static final String LOG4j2_PROPERTIES_FILE = 
"llap-daemon-log4j2.properties";
+  public static final String LLAP_LOG4J2_PROPERTIES_FILE_NAME_ENV = 
"LLAP_LOG4J2_PROPERTIES_FILE_NAME";
   public static final String LLAP_HADOOP_METRICS2_PROPERTIES_FILE = 
"hadoop-metrics2-llapdaemon.properties";
   public static final String HADOOP_METRICS2_PROPERTIES_FILE = 
"hadoop-metrics2.properties";
 
diff --git 
a/llap-server/src/java/org/apache/hadoop/hive/llap/daemon/impl/LlapDaemon.java 
b/llap-server/src/java/org/apache/hadoop/hive/llap/daemon/impl/LlapDaemon.java
index 52990c5..b13a2fd 100644
--- 
a/llap-server/src/java/org/apache/hadoop/hive/llap/daemon/impl/LlapDaemon.java
+++ 
b/llap-server/src/java/org/apache/hadoop/hive/llap/daemon/impl/LlapDaemon.java
@@ -338,8 +338,11 @@ public class LlapDaemon extends CompositeService 
implements ContainerRunner, Lla
 
   private static void initializeLogging(final Configuration conf) {
     long start = System.currentTimeMillis();
-    URL llap_l4j2 = LlapDaemon.class.getClassLoader().getResource(
-        LlapConstants.LOG4j2_PROPERTIES_FILE);
+    String log4j2FileName = 
System.getenv(LlapConstants.LLAP_LOG4J2_PROPERTIES_FILE_NAME_ENV);
+    if (log4j2FileName == null || log4j2FileName.isEmpty()) {
+      log4j2FileName = LlapConstants.LOG4j2_PROPERTIES_FILE;
+    }
+    URL llap_l4j2 = 
LlapDaemon.class.getClassLoader().getResource(log4j2FileName);
     if (llap_l4j2 != null) {
       final boolean async = LogUtils.checkAndSetAsyncLogging(conf);
       // required for MDC based routing appender so that child threads can 
inherit the MDC context

Reply via email to