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:40:47 +0100 |
commit | 1ce6428907b4ddcf52dbf0c86196d82ab7392442 (patch) | |
tree | fb7d3ee742d7be12aa69bab08eb9db2747590909 /core/src | |
parent | 3083e17645e4b707646fe48e406e02c156a0f37b (diff) | |
download | spark-1ce6428907b4ddcf52dbf0c86196d82ab7392442.tar.gz spark-1ce6428907b4ddcf52dbf0c86196d82ab7392442.tar.bz2 spark-1ce6428907b4ddcf52dbf0c86196d82ab7392442.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.
Diffstat (limited to 'core/src')
-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 baa4c661cc..251a797dc2 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") { |