HADOOP-13323. Downgrade stack trace on FS load from Warn to debug. Contributed by Steve Loughran.

(cherry picked from commit 2d46c3f6b7)
This commit is contained in:
Chris Nauroth 2016-10-06 10:57:01 -07:00
parent 7aee005c03
commit ecccb114ae
2 changed files with 13 additions and 9 deletions

View File

@ -2858,7 +2858,15 @@ public abstract class FileSystem extends Configured implements Closeable {
ClassUtil.findContainingJar(fs.getClass()), e);
}
} catch (ServiceConfigurationError ee) {
LOG.warn("Cannot load filesystem", ee);
LOG.warn("Cannot load filesystem: " + ee);
Throwable cause = ee.getCause();
// print all the nested exception messages
while (cause != null) {
LOG.warn(cause.toString());
cause = cause.getCause();
}
// and at debug: the full stack
LOG.debug("Stack Trace", ee);
}
}
FILE_SYSTEMS_LOADED = true;

View File

@ -47,16 +47,12 @@ public class TestFileSystemInitialization {
@Test
public void testMissingLibraries() {
boolean catched = false;
try {
Configuration conf = new Configuration();
FileSystem.getFileSystemClass("s3a", conf);
} catch (Exception e) {
catched = true;
} catch (ServiceConfigurationError e) {
// S3A shouldn't find AWS SDK and fail
catched = true;
}
assertTrue(catched);
Class<? extends FileSystem> fs = FileSystem.getFileSystemClass("s3a",
conf);
fail("Expected an exception, got a filesystem: " + fs);
} catch (Exception | ServiceConfigurationError expected) {
}
}
}