From e1f83ab7c6e7e0dc9a0c4c223cf95b258400c41e Mon Sep 17 00:00:00 2001 From: Shivaram Venkataraman Date: Wed, 18 Mar 2015 22:17:39 -0700 Subject: [PATCH 1/2] Send Spark INFO logs to a file in SparkR tests --- R/BUILDING.md | 5 ++--- R/log4j.properties | 28 ++++++++++++++++++++++++++++ R/pkg/inst/profile/shell.R | 1 - R/run-tests.sh | 4 ++-- 4 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 R/log4j.properties diff --git a/R/BUILDING.md b/R/BUILDING.md index 08d9a8129009f..3f889c0ca3d1e 100644 --- a/R/BUILDING.md +++ b/R/BUILDING.md @@ -9,6 +9,5 @@ include Rtools and R in `PATH`. `JAVA_HOME` in the system environment variables. 3. Download and install [Maven](http://maven.apache.org/download.html). Also include the `bin` directory in Maven in `PATH`. -4. Get SparkR source code either using [`git`](http://git-scm.com/downloads) or by downloading a -source zip from github. -5. Open a command shell (`cmd`) in the SparkR directory and run `install-dev.bat` +4. Set `MAVEN_OPTS` as described in [Building Spark](http://spark.apache.org/docs/latest/building-spark.html). +5. Open a command shell (`cmd`) in the Spark directory and run `mvn -DskipTests -Psparkr package` diff --git a/R/log4j.properties b/R/log4j.properties new file mode 100644 index 0000000000000..701adb2a3da1d --- /dev/null +++ b/R/log4j.properties @@ -0,0 +1,28 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# Set everything to be logged to the file target/unit-tests.log +log4j.rootCategory=INFO, file +log4j.appender.file=org.apache.log4j.FileAppender +log4j.appender.file.append=true +log4j.appender.file.file=R-unit-tests.log +log4j.appender.file.layout=org.apache.log4j.PatternLayout +log4j.appender.file.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss.SSS} %t %p %c{1}: %m%n + +# Ignore messages below warning level from Jetty, because it's a bit verbose +log4j.logger.org.eclipse.jetty=WARN +org.eclipse.jetty.LEVEL=WARN diff --git a/R/pkg/inst/profile/shell.R b/R/pkg/inst/profile/shell.R index 29286374e0487..0658aab9fb1e1 100644 --- a/R/pkg/inst/profile/shell.R +++ b/R/pkg/inst/profile/shell.R @@ -18,7 +18,6 @@ .First <- function() { home <- Sys.getenv("SPARK_HOME") .libPaths(c(file.path(home, "R", "lib"), .libPaths())) - cat(.libPaths()) Sys.setenv(NOAWT=1) require(utils) diff --git a/R/run-tests.sh b/R/run-tests.sh index a1fa079f13d86..8e8c23d53e7f1 100755 --- a/R/run-tests.sh +++ b/R/run-tests.sh @@ -20,10 +20,10 @@ FWDIR="$(cd `dirname $0`; pwd)" FAILED=0 -LOGFILE=unit-tests.log +LOGFILE=$FWDIR/R-unit-tests.out rm -f $LOGFILE -SPARK_TESTING=1 $FWDIR/../bin/sparkR $FWDIR/pkg/tests/run-all.R >$LOGFILE 2>&1 +SPARK_TESTING=1 $FWDIR/../bin/sparkR --driver-java-options "-Dlog4j.configuration=file:$FWDIR/log4j.properties" $FWDIR/pkg/tests/run-all.R 2>&1 | tee $LOGFILE FAILED=$((PIPESTATUS[0]||$FAILED)) if [[ $FAILED != 0 ]]; then From a1493d7e903b886042daaaaa9db16c52222e59a6 Mon Sep 17 00:00:00 2001 From: Shivaram Venkataraman Date: Thu, 19 Mar 2015 10:39:01 -0700 Subject: [PATCH 2/2] Address comments --- R/run-tests.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/run-tests.sh b/R/run-tests.sh index 8e8c23d53e7f1..e82ad0ba2cd06 100755 --- a/R/run-tests.sh +++ b/R/run-tests.sh @@ -20,10 +20,10 @@ FWDIR="$(cd `dirname $0`; pwd)" FAILED=0 -LOGFILE=$FWDIR/R-unit-tests.out +LOGFILE=$FWDIR/unit-tests.out rm -f $LOGFILE -SPARK_TESTING=1 $FWDIR/../bin/sparkR --driver-java-options "-Dlog4j.configuration=file:$FWDIR/log4j.properties" $FWDIR/pkg/tests/run-all.R 2>&1 | tee $LOGFILE +SPARK_TESTING=1 $FWDIR/../bin/sparkR --driver-java-options "-Dlog4j.configuration=file:$FWDIR/log4j.properties" $FWDIR/pkg/tests/run-all.R 2>&1 | tee -a $LOGFILE FAILED=$((PIPESTATUS[0]||$FAILED)) if [[ $FAILED != 0 ]]; then