Repository: incubator-samza
Updated Branches:
  refs/heads/master 6f595beda -> 247733e38


SAMZA-450; allow log4j.xml to be overridden


Project: http://git-wip-us.apache.org/repos/asf/incubator-samza/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-samza/commit/247733e3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-samza/tree/247733e3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-samza/diff/247733e3

Branch: refs/heads/master
Commit: 247733e38e00922c6de26465b6ba7148ccc42cd4
Parents: 6f595be
Author: Chris Riccomini <[email protected]>
Authored: Thu Oct 30 12:21:33 2014 -0700
Committer: Chris Riccomini <[email protected]>
Committed: Thu Oct 30 12:21:33 2014 -0700

----------------------------------------------------------------------
 .../apache/samza/job/local/ThreadJobFactory.scala  |  2 +-
 samza-shell/src/main/bash/checkpoint-tool.sh       |  4 +---
 samza-shell/src/main/bash/kill-yarn-job.sh         |  4 +---
 samza-shell/src/main/bash/run-am.sh                |  6 +++---
 samza-shell/src/main/bash/run-class.sh             | 17 ++++++++++-------
 samza-shell/src/main/bash/run-container.sh         |  9 ++++++---
 samza-shell/src/main/bash/run-job.sh               |  4 +---
 7 files changed, 23 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-samza/blob/247733e3/samza-core/src/main/scala/org/apache/samza/job/local/ThreadJobFactory.scala
----------------------------------------------------------------------
diff --git 
a/samza-core/src/main/scala/org/apache/samza/job/local/ThreadJobFactory.scala 
b/samza-core/src/main/scala/org/apache/samza/job/local/ThreadJobFactory.scala
index 7504e6d..530255e 100644
--- 
a/samza-core/src/main/scala/org/apache/samza/job/local/ThreadJobFactory.scala
+++ 
b/samza-core/src/main/scala/org/apache/samza/job/local/ThreadJobFactory.scala
@@ -41,7 +41,7 @@ class ThreadJobFactory extends StreamJobFactory with Logging {
 
     // Give developers a nice friendly warning if they've specified task.opts 
and are using a threaded job.
     config.getTaskOpts match {
-      case Some(taskOpts) => warn("%s was specified in config, but is not 
being used because job is being executed with ThreadJob. You probably want to 
run %s=%s." format (TASK_JVM_OPTS, STREAM_JOB_FACTORY_CLASS, 
classOf[ThreadJobFactory].getName))
+      case Some(taskOpts) => warn("%s was specified in config, but is not 
being used because job is being executed with ThreadJob. You probably want to 
run %s=%s." format (TASK_JVM_OPTS, STREAM_JOB_FACTORY_CLASS, 
classOf[ProcessJobFactory].getName))
       case _ => None
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-samza/blob/247733e3/samza-shell/src/main/bash/checkpoint-tool.sh
----------------------------------------------------------------------
diff --git a/samza-shell/src/main/bash/checkpoint-tool.sh 
b/samza-shell/src/main/bash/checkpoint-tool.sh
index 5688b59..72a5051 100755
--- a/samza-shell/src/main/bash/checkpoint-tool.sh
+++ b/samza-shell/src/main/bash/checkpoint-tool.sh
@@ -16,8 +16,6 @@
 # specific language governing permissions and limitations
 # under the License.
 
-if [ -z "$SAMZA_LOG4J_CONFIG" ]; then
-  export SAMZA_LOG4J_CONFIG=file:$(dirname $0)/log4j-console.xml
-fi
+[[ $JAVA_OPTS != *-Dlog4j.configuration* ]] && export JAVA_OPTS="$JAVA_OPTS 
-Dlog4j.configuration=file:$(dirname $0)/log4j-console.xml"
 
 exec $(dirname $0)/run-class.sh org.apache.samza.checkpoint.CheckpointTool $@

http://git-wip-us.apache.org/repos/asf/incubator-samza/blob/247733e3/samza-shell/src/main/bash/kill-yarn-job.sh
----------------------------------------------------------------------
diff --git a/samza-shell/src/main/bash/kill-yarn-job.sh 
b/samza-shell/src/main/bash/kill-yarn-job.sh
index d42e086..cc234f1 100755
--- a/samza-shell/src/main/bash/kill-yarn-job.sh
+++ b/samza-shell/src/main/bash/kill-yarn-job.sh
@@ -16,8 +16,6 @@
 # specific language governing permissions and limitations
 # under the License.
 
-if [ -z "$SAMZA_LOG4J_CONFIG" ]; then
-  export SAMZA_LOG4J_CONFIG=file:$(dirname $0)/log4j-console.xml
-fi
+[[ $JAVA_OPTS != *-Dlog4j.configuration* ]] && export JAVA_OPTS="$JAVA_OPTS 
-Dlog4j.configuration=file:$(dirname $0)/log4j-console.xml"
 
 exec $(dirname $0)/run-class.sh 
org.apache.hadoop.yarn.client.cli.ApplicationCLI application -kill $@

http://git-wip-us.apache.org/repos/asf/incubator-samza/blob/247733e3/samza-shell/src/main/bash/run-am.sh
----------------------------------------------------------------------
diff --git a/samza-shell/src/main/bash/run-am.sh 
b/samza-shell/src/main/bash/run-am.sh
index 4cc4f00..e362eea 100755
--- a/samza-shell/src/main/bash/run-am.sh
+++ b/samza-shell/src/main/bash/run-am.sh
@@ -17,9 +17,9 @@
 # under the License.
 
 # Check if server is set. If not - set server optimization
-[[ $JAVA_OPTS != *-server* ]] && JAVA_OPTS="$JAVA_OPTS -server"
+[[ $JAVA_OPTS != *-server* ]] && export JAVA_OPTS="$JAVA_OPTS -server"
 
-# Set container ID and name system properties for use in Log4J
-JAVA_OPTS="$JAVA_OPTS -Dsamza.container.name=samza-application-master"
+# Set container name system properties for use in Log4J
+[[ $JAVA_OPTS != *-Dsamza.container.name* ]] && export JAVA_OPTS="$JAVA_OPTS 
-Dsamza.container.name=samza-application-master"
 
 exec $(dirname $0)/run-class.sh org.apache.samza.job.yarn.SamzaAppMaster $@

http://git-wip-us.apache.org/repos/asf/incubator-samza/blob/247733e3/samza-shell/src/main/bash/run-class.sh
----------------------------------------------------------------------
diff --git a/samza-shell/src/main/bash/run-class.sh 
b/samza-shell/src/main/bash/run-class.sh
index 155f29b..d0ae57f 100755
--- a/samza-shell/src/main/bash/run-class.sh
+++ b/samza-shell/src/main/bash/run-class.sh
@@ -37,6 +37,7 @@ HADOOP_YARN_HOME="${HADOOP_YARN_HOME:-$HOME/.samza}"
 HADOOP_CONF_DIR="${HADOOP_CONF_DIR:-$HADOOP_YARN_HOME/conf}"
 CLASSPATH=$HADOOP_CONF_DIR
 GC_LOG_ROTATION_OPTS="-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 
-XX:GCLogFileSize=10241024"
+DEFAULT_LOG4J_FILE=$base_dir/lib/log4j.xml
 
 for file in $base_dir/lib/*.[jw]ar;
 do
@@ -73,13 +74,17 @@ function check_and_enable_64_bit_mode {
   fi
 }
 
-# Initialize SAMZA_LOG4J_CONFIG if currently undefined
-if [ -z "$SAMZA_LOG4J_CONFIG" ]; then
-  export SAMZA_LOG4J_CONFIG=file:$base_dir/lib/log4j.xml
-fi
-
 ### Inherit JVM_OPTS from task.opts configuration, and initialize defaults ###
 
+# Check if log4j configuration is specified. If not - set to lib/log4j.xml
+[[ $JAVA_OPTS != *-Dlog4j.configuration* && -f $DEFAULT_LOG4J_FILE ]] && 
JAVA_OPTS="$JAVA_OPTS -Dlog4j.configuration=file:$DEFAULT_LOG4J_FILE"
+
+# Check if samza.log.dir is specified. If not - set to environment variable if 
it is set
+[[ $JAVA_OPTS != *-Dsamza.log.dir* && ! -z "$SAMZA_LOG_DIR" ]] && 
JAVA_OPTS="$JAVA_OPTS -Dsamza.log.dir=$SAMZA_LOG_DIR"
+
+# Check if java.io.tmpdir is specified. If not - set to tmp in the base_dir
+[[ $JAVA_OPTS != *-Djava.io.tmpdir* ]] && JAVA_OPTS="$JAVA_OPTS 
-Djava.io.tmpdir=$JAVA_TEMP_DIR"
+
 # Check if a max-heap size is specified. If not - set a 768M heap
 [[ $JAVA_OPTS != *-Xmx* ]] && JAVA_OPTS="$JAVA_OPTS -Xmx768M"
 
@@ -92,7 +97,5 @@ fi
 # Check if 64 bit is set. If not - try and set it if it's supported
 [[ $JAVA_OPTS != *-d64* ]] && check_and_enable_64_bit_mode
 
-JAVA_OPTS="$JAVA_OPTS -Dlog4j.configuration=$SAMZA_LOG4J_CONFIG 
-Dsamza.log.dir=$SAMZA_LOG_DIR -Djava.io.tmpdir=$JAVA_TEMP_DIR"
-
 echo $JAVA $JAVA_OPTS -cp $CLASSPATH $@
 exec $JAVA $JAVA_OPTS -cp $CLASSPATH $@

http://git-wip-us.apache.org/repos/asf/incubator-samza/blob/247733e3/samza-shell/src/main/bash/run-container.sh
----------------------------------------------------------------------
diff --git a/samza-shell/src/main/bash/run-container.sh 
b/samza-shell/src/main/bash/run-container.sh
index 4ac375c..d90afc7 100755
--- a/samza-shell/src/main/bash/run-container.sh
+++ b/samza-shell/src/main/bash/run-container.sh
@@ -17,9 +17,12 @@
 # under the License.
 
 # Check if server is set. If not - set server optimization
-[[ $JAVA_OPTS != *-server* ]] && JAVA_OPTS="$JAVA_OPTS -server"
+[[ $JAVA_OPTS != *-server* ]] && export JAVA_OPTS="$JAVA_OPTS -server"
 
-# Set container ID and name system properties for use in Log4J
-JAVA_OPTS="$JAVA_OPTS -Dsamza.container.id=$SAMZA_CONTAINER_ID 
-Dsamza.container.name=samza-container-$SAMZA_CONTAINER_ID"
+# Set container ID system property for use in Log4J
+[[ $JAVA_OPTS != *-Dsamza.container.id* && ! -z "$SAMZA_CONTAINER_ID" ]] && 
export JAVA_OPTS="$JAVA_OPTS -Dsamza.container.id=$SAMZA_CONTAINER_ID"
+
+# Set container name system property for use in Log4J
+[[ $JAVA_OPTS != *-Dsamza.container.name* && ! -z "$SAMZA_CONTAINER_ID" ]] && 
export JAVA_OPTS="$JAVA_OPTS 
-Dsamza.container.name=samza-container-$SAMZA_CONTAINER_ID"
 
 exec $(dirname $0)/run-class.sh org.apache.samza.container.SamzaContainer $@

http://git-wip-us.apache.org/repos/asf/incubator-samza/blob/247733e3/samza-shell/src/main/bash/run-job.sh
----------------------------------------------------------------------
diff --git a/samza-shell/src/main/bash/run-job.sh 
b/samza-shell/src/main/bash/run-job.sh
index d43b556..2e1b0b4 100755
--- a/samza-shell/src/main/bash/run-job.sh
+++ b/samza-shell/src/main/bash/run-job.sh
@@ -16,8 +16,6 @@
 # specific language governing permissions and limitations
 # under the License.
 
-if [ -z "$SAMZA_LOG4J_CONFIG" ]; then
-  export SAMZA_LOG4J_CONFIG=file:$(dirname $0)/log4j-console.xml
-fi
+[[ $JAVA_OPTS != *-Dlog4j.configuration* ]] && export JAVA_OPTS="$JAVA_OPTS 
-Dlog4j.configuration=file:$(dirname $0)/log4j-console.xml"
 
 exec $(dirname $0)/run-class.sh org.apache.samza.job.JobRunner $@

Reply via email to