HADOOP-15686. Supress bogus AbstractWadlGeneratorGrammarGenerator in KMS stderr. Contributed by Wei-Chiu Chuang.

Reviewed-by: Xiaoyu Yao <xyao@apache.org>
This commit is contained in:
Wei-Chiu Chuang 2019-11-18 13:50:07 -08:00
parent 3037762b2c
commit 9664b9c7a6
3 changed files with 19 additions and 1 deletions

View File

@ -37,6 +37,7 @@
import org.apache.hadoop.util.VersionInfo; import org.apache.hadoop.util.VersionInfo;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.slf4j.bridge.SLF4JBridgeHandler;
@InterfaceAudience.Private @InterfaceAudience.Private
public class KMSWebApp implements ServletContextListener { public class KMSWebApp implements ServletContextListener {
@ -80,6 +81,11 @@ public class KMSWebApp implements ServletContextListener {
private static KMSAudit kmsAudit; private static KMSAudit kmsAudit;
private static KeyProviderCryptoExtension keyProviderCryptoExtension; private static KeyProviderCryptoExtension keyProviderCryptoExtension;
static {
SLF4JBridgeHandler.removeHandlersForRootLogger();
SLF4JBridgeHandler.install();
}
@Override @Override
public void contextInitialized(ServletContextEvent sce) { public void contextInitialized(ServletContextEvent sce) {
try { try {

View File

@ -614,7 +614,18 @@ public Void run() throws Exception {
@Test @Test
public void testStartStopHttpPseudo() throws Exception { public void testStartStopHttpPseudo() throws Exception {
testStartStop(false, false); // Make sure bogus errors don't get emitted.
GenericTestUtils.LogCapturer logs =
GenericTestUtils.LogCapturer.captureLogs(LoggerFactory.getLogger(
"com.sun.jersey.server.wadl.generators.AbstractWadlGeneratorGrammarGenerator"));
try {
testStartStop(false, false);
} finally {
logs.stopCapturing();
}
assertFalse(logs.getOutput().contains(
"Couldn't find grammar element for class"));
} }
@Test @Test

View File

@ -26,6 +26,7 @@ log4j.rootLogger=INFO, stdout
log4j.logger.org.apache.hadoop.conf=ERROR log4j.logger.org.apache.hadoop.conf=ERROR
log4j.logger.org.apache.hadoop.crytpo.key.kms.server=ALL log4j.logger.org.apache.hadoop.crytpo.key.kms.server=ALL
log4j.logger.com.sun.jersey.server.wadl.generators.WadlGeneratorJAXBGrammarGenerator=OFF log4j.logger.com.sun.jersey.server.wadl.generators.WadlGeneratorJAXBGrammarGenerator=OFF
log4j.logger.com.sun.jersey.server.wadl.generators.AbstractWadlGeneratorGrammarGenerator=OFF
log4j.logger.org.apache.hadoop.security=OFF log4j.logger.org.apache.hadoop.security=OFF
log4j.logger.org.apache.directory.server.core=OFF log4j.logger.org.apache.directory.server.core=OFF
log4j.logger.org.apache.hadoop.util.NativeCodeLoader=OFF log4j.logger.org.apache.hadoop.util.NativeCodeLoader=OFF