diff options
author | Marcelo Vanzin <vanzin@cloudera.com> | 2015-07-01 20:40:47 +0100 |
---|---|---|
committer | Sean Owen <sowen@cloudera.com> | 2015-07-01 20:41:00 +0100 |
commit | 228aabe244d03886cd1c106c73df51054f882e73 (patch) | |
tree | 4ab340f76e1fafa95fd3fb3cb194effd78e30772 | |
parent | bcfb37bf6987f15be7d1c48ef97f1630e3481af8 (diff) | |
download | spark-228aabe244d03886cd1c106c73df51054f882e73.tar.gz spark-228aabe244d03886cd1c106c73df51054f882e73.tar.bz2 spark-228aabe244d03886cd1c106c73df51054f882e73.zip |
[SPARK-3444] [CORE] Restore INFO level after log4j test.
Otherwise other tests don't log anything useful...
Author: Marcelo Vanzin <vanzin@cloudera.com>
Closes #7140 from vanzin/SPARK-3444 and squashes the following commits:
de14836 [Marcelo Vanzin] Better fix.
6cff13a [Marcelo Vanzin] [SPARK-3444] [core] Restore INFO level after log4j test.
(cherry picked from commit 1ce6428907b4ddcf52dbf0c86196d82ab7392442)
Signed-off-by: Sean Owen <sowen@cloudera.com>
-rw-r--r-- | core/src/test/scala/org/apache/spark/util/UtilsSuite.scala | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/core/src/test/scala/org/apache/spark/util/UtilsSuite.scala b/core/src/test/scala/org/apache/spark/util/UtilsSuite.scala index a61ea3918f..6f1704159a 100644 --- a/core/src/test/scala/org/apache/spark/util/UtilsSuite.scala +++ b/core/src/test/scala/org/apache/spark/util/UtilsSuite.scala @@ -486,11 +486,17 @@ class UtilsSuite extends SparkFunSuite with ResetSystemProperties with Logging { // Test for using the util function to change our log levels. test("log4j log level change") { - Utils.setLogLevel(org.apache.log4j.Level.ALL) - assert(log.isInfoEnabled()) - Utils.setLogLevel(org.apache.log4j.Level.ERROR) - assert(!log.isInfoEnabled()) - assert(log.isErrorEnabled()) + val current = org.apache.log4j.Logger.getRootLogger().getLevel() + try { + Utils.setLogLevel(org.apache.log4j.Level.ALL) + assert(log.isInfoEnabled()) + Utils.setLogLevel(org.apache.log4j.Level.ERROR) + assert(!log.isInfoEnabled()) + assert(log.isErrorEnabled()) + } finally { + // Best effort at undoing changes this test made. + Utils.setLogLevel(current) + } } test("deleteRecursively") { |