File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
core/src/test/scala/org/apache/spark/util Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -486,11 +486,17 @@ class UtilsSuite extends SparkFunSuite with ResetSystemProperties with Logging {
486486
487487 // Test for using the util function to change our log levels.
488488 test(" log4j log level change" ) {
489- Utils .setLogLevel(org.apache.log4j.Level .ALL )
490- assert(log.isInfoEnabled())
491- Utils .setLogLevel(org.apache.log4j.Level .ERROR )
492- assert(! log.isInfoEnabled())
493- assert(log.isErrorEnabled())
489+ try {
490+ Utils .setLogLevel(org.apache.log4j.Level .ALL )
491+ assert(log.isInfoEnabled())
492+ Utils .setLogLevel(org.apache.log4j.Level .ERROR )
493+ assert(! log.isInfoEnabled())
494+ assert(log.isErrorEnabled())
495+ } finally {
496+ // Best effort at undoing changes this test made. Level should be synchronized with the
497+ // log4j.properties file used for testing.
498+ Utils .setLogLevel(org.apache.log4j.Level .INFO )
499+ }
494500 }
495501
496502 test(" deleteRecursively" ) {
You can’t perform that action at this time.
0 commit comments