Skip to content

Commit b21a0da

Browse files
author
Davies Liu
committed
Merge pull request #1 from shivaram/log4j-tests
Send Spark INFO logs to a file in SparkR tests
2 parents 58276f5 + a1493d7 commit b21a0da

File tree

4 files changed

+32
-6
lines changed

4 files changed

+32
-6
lines changed

R/BUILDING.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,5 @@ include Rtools and R in `PATH`.
99
`JAVA_HOME` in the system environment variables.
1010
3. Download and install [Maven](http://maven.apache.org/download.html). Also include the `bin`
1111
directory in Maven in `PATH`.
12-
4. Get SparkR source code either using [`git`](http://git-scm.com/downloads) or by downloading a
13-
source zip from github.
14-
5. Open a command shell (`cmd`) in the SparkR directory and run `install-dev.bat`
12+
4. Set `MAVEN_OPTS` as described in [Building Spark](http://spark.apache.org/docs/latest/building-spark.html).
13+
5. Open a command shell (`cmd`) in the Spark directory and run `mvn -DskipTests -Psparkr package`

R/log4j.properties

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
# Set everything to be logged to the file target/unit-tests.log
19+
log4j.rootCategory=INFO, file
20+
log4j.appender.file=org.apache.log4j.FileAppender
21+
log4j.appender.file.append=true
22+
log4j.appender.file.file=R-unit-tests.log
23+
log4j.appender.file.layout=org.apache.log4j.PatternLayout
24+
log4j.appender.file.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss.SSS} %t %p %c{1}: %m%n
25+
26+
# Ignore messages below warning level from Jetty, because it's a bit verbose
27+
log4j.logger.org.eclipse.jetty=WARN
28+
org.eclipse.jetty.LEVEL=WARN

R/pkg/inst/profile/shell.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
.First <- function() {
1919
home <- Sys.getenv("SPARK_HOME")
2020
.libPaths(c(file.path(home, "R", "lib"), .libPaths()))
21-
cat(.libPaths())
2221
Sys.setenv(NOAWT=1)
2322

2423
require(utils)

R/run-tests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
FWDIR="$(cd `dirname $0`; pwd)"
2121

2222
FAILED=0
23-
LOGFILE=unit-tests.log
23+
LOGFILE=$FWDIR/unit-tests.out
2424
rm -f $LOGFILE
2525

26-
SPARK_TESTING=1 $FWDIR/../bin/sparkR $FWDIR/pkg/tests/run-all.R >$LOGFILE 2>&1
26+
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
2727
FAILED=$((PIPESTATUS[0]||$FAILED))
2828

2929
if [[ $FAILED != 0 ]]; then

0 commit comments

Comments
 (0)