Add logging to test server

This commit is contained in:
jamesagnew 2021-05-28 05:41:53 -04:00
parent d70bbad6f1
commit 5b93affca1
1 changed files with 7 additions and 0 deletions

View File

@ -31,6 +31,7 @@ import ca.uhn.fhir.rest.server.RestfulServer;
import ca.uhn.fhir.rest.server.interceptor.BanUnsupportedHttpMethodsInterceptor;
import ca.uhn.fhir.rest.server.interceptor.CorsInterceptor;
import ca.uhn.fhir.rest.server.interceptor.FhirPathFilterInterceptor;
import ca.uhn.fhir.rest.server.interceptor.LoggingInterceptor;
import ca.uhn.fhir.rest.server.interceptor.ResponseHighlighterInterceptor;
import ca.uhn.fhir.rest.server.provider.ResourceProviderFactory;
import ca.uhn.fhirtest.config.TestDstu2Config;
@ -274,6 +275,12 @@ public class TestRestfulServer extends RestfulServer {
* OpenAPI
*/
registerInterceptor(new OpenApiInterceptor());
// Logging for request type
LoggingInterceptor loggingInterceptor = new LoggingInterceptor();
loggingInterceptor.setMessageFormat("ContentType / Accept for ${operationType}: ${requestHeader.content-type} / ${requestHeader.accept}");
registerInterceptor(loggingInterceptor);
}
/**