HADOOP-13854. KMS should log error details in KMSExceptionsProvider.

This commit is contained in:
Xiao Chen 2017-06-08 22:35:31 -07:00
parent 0202480742
commit c4b5c32669
2 changed files with 5 additions and 1 deletions

View File

@ -70,7 +70,7 @@ public enum KMSOp {
private KeyProviderCryptoExtension provider; private KeyProviderCryptoExtension provider;
private KMSAudit kmsAudit; private KMSAudit kmsAudit;
private static final Logger LOG = LoggerFactory.getLogger(KMS.class); static final Logger LOG = LoggerFactory.getLogger(KMS.class);
public KMS() throws Exception { public KMS() throws Exception {
provider = KMSWebApp.getKeyProvider(); provider = KMSWebApp.getKeyProvider();

View File

@ -43,6 +43,7 @@
public class KMSExceptionsProvider implements ExceptionMapper<Exception> { public class KMSExceptionsProvider implements ExceptionMapper<Exception> {
private static Logger LOG = private static Logger LOG =
LoggerFactory.getLogger(KMSExceptionsProvider.class); LoggerFactory.getLogger(KMSExceptionsProvider.class);
private final static Logger EXCEPTION_LOG = KMS.LOG;
private static final String ENTER = System.getProperty("line.separator"); private static final String ENTER = System.getProperty("line.separator");
@ -100,6 +101,9 @@ public Response toResponse(Exception exception) {
KMSMDCFilter.getMethod(), KMSMDCFilter.getMethod(),
KMSMDCFilter.getURL(), getOneLineMessage(exception)); KMSMDCFilter.getURL(), getOneLineMessage(exception));
} }
EXCEPTION_LOG.warn("User {} request {} {} caused exception.",
KMSMDCFilter.getUgi(), KMSMDCFilter.getMethod(),
KMSMDCFilter.getURL(), exception);
return createResponse(status, throwable); return createResponse(status, throwable);
} }