Class LoggingInterceptor
- java.lang.Object
-
- ca.uhn.fhir.rest.server.interceptor.LoggingInterceptor
-
public class LoggingInterceptor extends Object
Server interceptor which logs each request using a defined formatThe following substitution variables are supported:
${id} The resource ID associated with this request (or "" if none) ${idOrResourceName} The resource ID associated with this request, or the resource name if the request applies to a type but not an instance, or "" otherwise ${operationName} If the request is an extended operation (e.g. "$validate") this value will be the operation name, or "" otherwise ${requestId} The request ID assigned to this request (either automatically, or via the X-Request-IDheader in the request)${operationType} A code indicating the operation type for this request, e.g. "read", "history-instance", "extended-operation-instance", etc.) ${remoteAddr} The originating IP of the request ${requestHeader.XXXX} The value of the HTTP request header named XXXX. For example, a substitution variable named "${requestHeader.x-forwarded-for} will yield the value of the first header named "x-forwarded-for ", or "" if none. ${requestParameters} The HTTP request parameters (or "") ${responseEncodingNoDefault} The encoding format requested by the client via the _format parameter or the Accept header. Value will be "json" or "xml", or "" if the client did not explicitly request a format ${servletPath} The part of thre requesting URL that corresponds to the particular Servlet being called (see HttpServletRequest.getServletPath())${requestBodyFhir} The complete body of the request if the request has a FHIR content-type (this can be quite large!). Will emit an empty string if the content type is not a FHIR content type ${requestUrl} The complete URL of the request ${requestVerb} The HTTP verb of the request ${exceptionMessage} Applies only to an error message: The message from Throwable.getMessage()${processingTimeMillis} The number of milliseconds spen processing this request
-
-
Constructor Summary
Constructors Constructor Description LoggingInterceptor()Constructor for server logging interceptor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetErrorMessageFormat()Get the log message format to be used when logging exceptionsbooleanhandleException(RequestDetails theRequestDetails, ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException theException, javax.servlet.http.HttpServletRequest theServletRequest, javax.servlet.http.HttpServletResponse theServletResponse)booleanisLogExceptions()Should exceptions be logged by this loggervoidprocessingCompletedNormally(ServletRequestDetails theRequestDetails)voidsetErrorMessageFormat(String theErrorMessageFormat)Set the log message format to be used when logging exceptionsvoidsetLogExceptions(boolean theLogExceptions)Should exceptions be logged by this loggervoidsetLogger(org.slf4j.Logger theLogger)voidsetLoggerName(String theLoggerName)voidsetMessageFormat(String theMessageFormat)Sets the message format itself.
-
-
-
Constructor Detail
-
LoggingInterceptor
public LoggingInterceptor()
Constructor for server logging interceptor
-
-
Method Detail
-
getErrorMessageFormat
public String getErrorMessageFormat()
Get the log message format to be used when logging exceptions
-
handleException
public boolean handleException(RequestDetails theRequestDetails, ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException theException, javax.servlet.http.HttpServletRequest theServletRequest, javax.servlet.http.HttpServletResponse theServletResponse) throws javax.servlet.ServletException, IOException
- Throws:
javax.servlet.ServletExceptionIOException
-
processingCompletedNormally
public void processingCompletedNormally(ServletRequestDetails theRequestDetails)
-
isLogExceptions
public boolean isLogExceptions()
Should exceptions be logged by this logger
-
setErrorMessageFormat
public void setErrorMessageFormat(String theErrorMessageFormat)
Set the log message format to be used when logging exceptions
-
setLogExceptions
public void setLogExceptions(boolean theLogExceptions)
Should exceptions be logged by this logger
-
setLogger
public void setLogger(org.slf4j.Logger theLogger)
-
setLoggerName
public void setLoggerName(String theLoggerName)
-
setMessageFormat
public void setMessageFormat(String theMessageFormat)
Sets the message format itself. See theclass documentationfor information on the format
-
-