diff --git a/hbase-http/src/main/java/org/apache/hadoop/hbase/http/HttpRequestLog.java b/hbase-http/src/main/java/org/apache/hadoop/hbase/http/HttpRequestLog.java index 57f40c4b482..d3e8005eb9c 100644 --- a/hbase-http/src/main/java/org/apache/hadoop/hbase/http/HttpRequestLog.java +++ b/hbase-http/src/main/java/org/apache/hadoop/hbase/http/HttpRequestLog.java @@ -20,8 +20,9 @@ package org.apache.hadoop.hbase.http; import org.apache.yetus.audience.InterfaceAudience; import org.apache.hbase.thirdparty.com.google.common.collect.ImmutableMap; +import org.apache.hbase.thirdparty.org.eclipse.jetty.server.CustomRequestLog; import org.apache.hbase.thirdparty.org.eclipse.jetty.server.RequestLog; -import org.apache.hbase.thirdparty.org.eclipse.jetty.server.Slf4jRequestLog; +import org.apache.hbase.thirdparty.org.eclipse.jetty.server.Slf4jRequestLogWriter; /** * RequestLog object for use with Http @@ -38,9 +39,9 @@ public final class HttpRequestLog { name = lookup; } String loggerName = "http.requests." + name; - Slf4jRequestLog logger = new Slf4jRequestLog(); - logger.setLoggerName(loggerName); - return logger; + Slf4jRequestLogWriter writer = new Slf4jRequestLogWriter(); + writer.setLoggerName(loggerName); + return new CustomRequestLog(writer, CustomRequestLog.EXTENDED_NCSA_FORMAT); } private HttpRequestLog() { diff --git a/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestHttpRequestLog.java b/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestHttpRequestLog.java index e8a6b06d248..1efc116df1f 100644 --- a/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestHttpRequestLog.java +++ b/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestHttpRequestLog.java @@ -17,6 +17,8 @@ */ package org.apache.hadoop.hbase.http; +import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -27,8 +29,9 @@ import org.junit.ClassRule; import org.junit.Test; import org.junit.experimental.categories.Category; +import org.apache.hbase.thirdparty.org.eclipse.jetty.server.CustomRequestLog; import org.apache.hbase.thirdparty.org.eclipse.jetty.server.RequestLog; -import org.apache.hbase.thirdparty.org.eclipse.jetty.server.Slf4jRequestLog; +import org.apache.hbase.thirdparty.org.eclipse.jetty.server.Slf4jRequestLogWriter; @Category({ MiscTests.class, SmallTests.class }) public class TestHttpRequestLog { @@ -41,6 +44,9 @@ public class TestHttpRequestLog { public void testAppenderDefined() { RequestLog requestLog = HttpRequestLog.getRequestLog("test"); assertNotNull("RequestLog should not be null", requestLog); - assertEquals("Class mismatch", Slf4jRequestLog.class, requestLog.getClass()); + assertThat(requestLog, instanceOf(CustomRequestLog.class)); + CustomRequestLog crl = (CustomRequestLog) requestLog; + assertThat(crl.getWriter(), instanceOf(Slf4jRequestLogWriter.class)); + assertEquals(CustomRequestLog.EXTENDED_NCSA_FORMAT, crl.getFormatString()); } }