From 7a0434dda2b5849d2a54e5d2bb0618cb8323721b Mon Sep 17 00:00:00 2001 From: yangjie01 Date: Thu, 29 Sep 2022 10:34:54 +0800 Subject: [PATCH] change to use test log config file --- connect/src/test/resources/log4j2.properties | 39 +++++++++++++++++++ .../planner/SparkConnectPlannerSuite.scala | 7 +--- 2 files changed, 40 insertions(+), 6 deletions(-) create mode 100644 connect/src/test/resources/log4j2.properties diff --git a/connect/src/test/resources/log4j2.properties b/connect/src/test/resources/log4j2.properties new file mode 100644 index 0000000000000..ab02104c69697 --- /dev/null +++ b/connect/src/test/resources/log4j2.properties @@ -0,0 +1,39 @@ +# +# 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 +rootLogger.level = info +rootLogger.appenderRef.file.ref = ${sys:test.appender:-File} + +appender.file.type = File +appender.file.name = File +appender.file.fileName = target/unit-tests.log +appender.file.layout.type = PatternLayout +appender.file.layout.pattern = %d{yy/MM/dd HH:mm:ss.SSS} %t %p %c{1}: %m%n%ex + +# Tests that launch java subprocesses can set the "test.appender" system property to +# "console" to avoid having the child process's logs overwrite the unit test's +# log file. +appender.console.type = Console +appender.console.name = console +appender.console.target = SYSTEM_ERR +appender.console.layout.type = PatternLayout +appender.console.layout.pattern = %t: %m%n%ex + +# Ignore messages below warning level from Jetty, because it's a bit verbose +logger.jetty.name = org.sparkproject.jetty +logger.jetty.level = warn diff --git a/connect/src/test/scala/org/apache/spark/sql/connect/planner/SparkConnectPlannerSuite.scala b/connect/src/test/scala/org/apache/spark/sql/connect/planner/SparkConnectPlannerSuite.scala index 3c18994ba7f8c..f24b09a8dd420 100644 --- a/connect/src/test/scala/org/apache/spark/sql/connect/planner/SparkConnectPlannerSuite.scala +++ b/connect/src/test/scala/org/apache/spark/sql/connect/planner/SparkConnectPlannerSuite.scala @@ -19,7 +19,7 @@ package org.apache.spark.sql.connect.planner import scala.collection.JavaConverters._ -import org.apache.spark.{SparkFunSuite, TestUtils} +import org.apache.spark.SparkFunSuite import org.apache.spark.connect.proto import org.apache.spark.sql.SparkSession import org.apache.spark.sql.catalyst.plans.logical.LogicalPlan @@ -58,11 +58,6 @@ class SparkConnectPlannerSuite extends SparkFunSuite with SparkConnectPlanTest { protected var spark: SparkSession = null - override def beforeAll(): Unit = { - super.beforeAll() - TestUtils.configTestLog4j2("INFO") - } - test("Simple Limit") { assertThrows[IndexOutOfBoundsException] { new SparkConnectPlanner(