You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by do...@apache.org on 2021/11/30 22:42:41 UTC

[spark] branch master updated: [SPARK-37505][MESOS][TESTS] Add a log4j.properties for `mesos` module UT

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

dongjoon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new fdb33dd  [SPARK-37505][MESOS][TESTS] Add a log4j.properties for `mesos` module UT
fdb33dd is described below

commit fdb33dd9e27ac5d69ea875ca5bb85dfd369e71f1
Author: yangjie01 <ya...@baidu.com>
AuthorDate: Tue Nov 30 14:40:54 2021 -0800

    [SPARK-37505][MESOS][TESTS] Add a log4j.properties for `mesos` module UT
    
    ### What changes were proposed in this pull request?
    `scalatest-maven-plugin` configure `file:src/test/resources/log4j.properties` as the UT log configuration, so this PR adds this `log4j.properties` file to the mesos module for UT.
    
    ### Why are the changes needed?
    Supplement missing log4j configuration file for mesos module .
    
    ### Does this PR introduce _any_ user-facing change?
    No.
    
    ### How was this patch tested?
    
    - Pass the Jenkins or GitHub Action
    
    - Manual test
    
    **Before**
    
    Run
    
    ```
    mvn clean install -pl resource-managers/mesos -Pmesos -am -DskipTests
    mvn test -pl resource-managers/mesos -Pmesos
    ```
    
    will print the following log:
    
    ```
    log4j:ERROR Could not read configuration file from URL [file:src/test/resources/log4j.properties].
    java.io.FileNotFoundException: src/test/resources/log4j.properties (No such file or directory)
    	at java.io.FileInputStream.open0(Native Method)
    	at java.io.FileInputStream.open(FileInputStream.java:195)
    	at java.io.FileInputStream.<init>(FileInputStream.java:138)
    	at java.io.FileInputStream.<init>(FileInputStream.java:93)
    	at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
    	at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
    	at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:557)
    	at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:526)
    	at org.apache.log4j.LogManager.<clinit>(LogManager.java:127)
    	at org.slf4j.impl.Log4jLoggerFactory.<init>(Log4jLoggerFactory.java:66)
    	at org.slf4j.impl.StaticLoggerBinder.<init>(StaticLoggerBinder.java:72)
    	at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:45)
    	at org.apache.spark.internal.Logging$.org$apache$spark$internal$Logging$$isLog4j12(Logging.scala:222)
    	at org.apache.spark.internal.Logging.initializeLogging(Logging.scala:127)
    	at org.apache.spark.internal.Logging.initializeLogIfNecessary(Logging.scala:111)
    	at org.apache.spark.internal.Logging.initializeLogIfNecessary$(Logging.scala:105)
    	at org.apache.spark.SparkFunSuite.initializeLogIfNecessary(SparkFunSuite.scala:62)
    	at org.apache.spark.internal.Logging.initializeLogIfNecessary(Logging.scala:102)
    	at org.apache.spark.internal.Logging.initializeLogIfNecessary$(Logging.scala:101)
    	at org.apache.spark.SparkFunSuite.initializeLogIfNecessary(SparkFunSuite.scala:62)
    	at org.apache.spark.internal.Logging.log(Logging.scala:49)
    	at org.apache.spark.internal.Logging.log$(Logging.scala:47)
    	at org.apache.spark.SparkFunSuite.log(SparkFunSuite.scala:62)
    	at org.apache.spark.SparkFunSuite.<init>(SparkFunSuite.scala:74)
    	at org.apache.spark.scheduler.cluster.mesos.MesosCoarseGrainedSchedulerBackendSuite.<init>(MesosCoarseGrainedSchedulerBackendSuite.scala:43)
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    	at java.lang.Class.newInstance(Class.java:442)
    	at org.scalatest.tools.DiscoverySuite$.getSuiteInstance(DiscoverySuite.scala:66)
    	at org.scalatest.tools.DiscoverySuite.$anonfun$nestedSuites$1(DiscoverySuite.scala:38)
    	at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:286)
    	at scala.collection.Iterator.foreach(Iterator.scala:943)
    	at scala.collection.Iterator.foreach$(Iterator.scala:943)
    	at scala.collection.AbstractIterator.foreach(Iterator.scala:1431)
    	at scala.collection.IterableLike.foreach(IterableLike.scala:74)
    	at scala.collection.IterableLike.foreach$(IterableLike.scala:73)
    	at scala.collection.AbstractIterable.foreach(Iterable.scala:56)
    	at scala.collection.TraversableLike.map(TraversableLike.scala:286)
    	at scala.collection.TraversableLike.map$(TraversableLike.scala:279)
    	at scala.collection.AbstractTraversable.map(Traversable.scala:108)
    	at org.scalatest.tools.DiscoverySuite.<init>(DiscoverySuite.scala:37)
    	at org.scalatest.tools.Runner$.genDiscoSuites$1(Runner.scala:1132)
    	at org.scalatest.tools.Runner$.doRunRunRunDaDoRunRun(Runner.scala:1226)
    	at org.scalatest.tools.Runner$.$anonfun$runOptionallyWithPassFailReporter$24(Runner.scala:993)
    	at org.scalatest.tools.Runner$.$anonfun$runOptionallyWithPassFailReporter$24$adapted(Runner.scala:971)
    	at org.scalatest.tools.Runner$.withClassLoaderAndDispatchReporter(Runner.scala:1482)
    	at org.scalatest.tools.Runner$.runOptionallyWithPassFailReporter(Runner.scala:971)
    	at org.scalatest.tools.Runner$.main(Runner.scala:775)
    	at org.scalatest.tools.Runner.main(Runner.scala)
    log4j:ERROR Ignoring configuration file [file:src/test/resources/log4j.properties].
    Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties
    ```
    
    and test log will print to console.
    
    **After**
    
    No above log in console and test log will print to `resource-managers/mesos/target/unit-tests.log` as other module.
    
    Closes #34759 from LuciferYang/SPARK-37505.
    
    Authored-by: yangjie01 <ya...@baidu.com>
    Signed-off-by: Dongjoon Hyun <do...@apache.org>
---
 .../mesos/src/test/resources/log4j.properties      | 27 ++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/resource-managers/mesos/src/test/resources/log4j.properties b/resource-managers/mesos/src/test/resources/log4j.properties
new file mode 100644
index 0000000..9ec6890
--- /dev/null
+++ b/resource-managers/mesos/src/test/resources/log4j.properties
@@ -0,0 +1,27 @@
+#
+# 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=DEBUG, file
+log4j.appender.file=org.apache.log4j.FileAppender
+log4j.appender.file.append=true
+log4j.appender.file.file=target/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.sparkproject.jetty=WARN

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org