Package swiss.trustbroker.common.tracing
Class DefaultOptraceLogger
java.lang.Object
swiss.trustbroker.common.tracing.DefaultOptraceLogger
- All Implemented Interfaces:
OpTraceLogger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the actually set RequestContext.booleanCheck if we should log responsesbooleanCheck if we should log responsesbooleanCheck if we should log transport detailslogAsyncClientCall(String calledObject, String calledMethod) Emit a asynchronous service invocation statement into the OP-TraceLog.logAsyncClientCall(String calledObject, String calledMethod, Object[][] optional) Emit a asynchronous service invocation statement into the OP-TraceLog.voidlogAsyncClientReturn(RequestContext rc, Object exception) Emit the return from a asynchronous service invocation statement into the OP-TraceLog.voidlogAsyncClientReturn(RequestContext rc, Object exception, Object[][] optional) Emit the return from a asynchronous service invocation statement into the OP-TraceLog.voidlogClientCall(String calledObject, String calledMethod) Emit a service invocation statement into the OP-TraceLog.voidlogClientCall(String calledObject, String calledMethod, Object[][] optional) Emit a service invocation statement into the OP-TraceLog.voidlogClientReturn(Object exception) Emit a return from service invocation statement into the OP-TraceLog.voidlogClientReturn(Object exception, Object[][] optional) Emit a return from service invocation statement into the OP-TraceLog.voidlogInitialEnter(String traceId, String object, String method, String principal, Object[][] optional, String clientId) Emit a service entering statement into the OP-TraceLog.voidlogInitialEnter(String traceId, String object, String method, String principal, Object[][] optional, String clientId, Object fullRequestContext, Object fullResponseContext) Emit a service entering statement into the OP-TraceLog.voidEmit a service entering statement into the OP-TraceLog.voidlogInitialReturn(Object exception, Object[][] optional) Emit a service leaving statement into the OP-TraceLog.
-
Constructor Details
-
DefaultOptraceLogger
public DefaultOptraceLogger(org.slf4j.Logger logger)
-
-
Method Details
-
getRequestContext
Description copied from interface:OpTraceLoggerGet the actually set RequestContext.- Specified by:
getRequestContextin interfaceOpTraceLogger- Returns:
- actually set RequestContext or null if not set.
-
logInitialEnter
public void logInitialEnter(String traceId, String object, String method, String principal, String clientId) Description copied from interface:OpTraceLoggerEmit a service entering statement into the OP-TraceLog. Use this method to log the entering into the first service called on this JVM for a given request/thread. A new RequestContext is created with the given parameters and the current time. It is assumed that no RequestContext object exists yet in this thread. In general this will be done when a request enters the web tier or when entering the business tier e.g. remote-ejb or webservice.- Specified by:
logInitialEnterin interfaceOpTraceLogger- Parameters:
traceId- initial traceId for that request (received from e.g. reverse proxy)object- called object or called servlet/filter or database namemethod- method called or request URL or SQL queryprincipal- userPrincipal emitted in the log statement.clientId- id of client as received from front-end (e.g. reverse proxy) server or session ID
-
logInitialEnter
public void logInitialEnter(String traceId, String object, String method, String principal, Object[][] optional, String clientId) Description copied from interface:OpTraceLoggerEmit a service entering statement into the OP-TraceLog.- Specified by:
logInitialEnterin interfaceOpTraceLogger- Parameters:
traceId- initial traceId for that request (received from e.g. reverse proxy)object- called object or called servlet/filter or database namemethod- method called or request URL or SQL queryprincipal- userPrincipal emitted in the log statement.optional- name/value pairs to be appended at the end of the log entryclientId- id of client as received from front-end (e.g. reverse proxy) server or session ID
-
logInitialEnter
public void logInitialEnter(String traceId, String object, String method, String principal, Object[][] optional, String clientId, Object fullRequestContext, Object fullResponseContext) Description copied from interface:OpTraceLoggerEmit a service entering statement into the OP-TraceLog.- Specified by:
logInitialEnterin interfaceOpTraceLogger- Parameters:
traceId- initial traceId for that request (received from e.g. reverse proxy)object- called object or called servlet/filter or database namemethod- method called or request URL or SQL queryprincipal- userPrincipal emitted in the log statement.optional- name/value pairs to be appended at the end of the log entryclientId- id of client as received from front-end (e.g. reverse proxy) server or session IDfullRequestContext- injection point dependent data (e.g. the HttpServletRequest)
-
logClientCall
Description copied from interface:OpTraceLoggerEmit a service invocation statement into the OP-TraceLog. Used to emit a log entry if one calls another service. The traceId is extended to give this call a unique traceId. Only use this method for synchronous calls. You have to call logClientReturn after using this method.- Specified by:
logClientCallin interfaceOpTraceLogger- Parameters:
calledObject- called object or called servlet/filter or database namecalledMethod- method called or request URL or SQL query
-
logClientCall
Description copied from interface:OpTraceLoggerEmit a service invocation statement into the OP-TraceLog.- Specified by:
logClientCallin interfaceOpTraceLogger- Parameters:
calledObject- called object or called servlet/filter or database namecalledMethod- method called or request URL or SQL queryoptional- name/value pairs to be appended at the end of the log entry- See Also:
-
logClientReturn
Description copied from interface:OpTraceLoggerEmit a return from service invocation statement into the OP-TraceLog. Used when returning from a call to another service. Only use this method, if you used logClientCall before.- Specified by:
logClientReturnin interfaceOpTraceLogger- Parameters:
exception- optional object which represents an error condition (null on success)
-
logClientReturn
Description copied from interface:OpTraceLoggerEmit a return from service invocation statement into the OP-TraceLog.- Specified by:
logClientReturnin interfaceOpTraceLogger- Parameters:
exception- optional object which represents an error condition (null on success)optional- name/value pairs to be appended at the end of the log entry- See Also:
-
logInitialReturn
Description copied from interface:OpTraceLoggerEmit a service leaving statement into the OP-TraceLog. Used before returning from a service method. Only use this method, if you used one of the logInitialEnter methods before.- Specified by:
logInitialReturnin interfaceOpTraceLogger- Parameters:
exception- optional object which represents an error condition (null on success)
-
logAsyncClientCall
Description copied from interface:OpTraceLoggerEmit a asynchronous service invocation statement into the OP-TraceLog. Used to emit a log entry if one calls another service. The traceId is extended to give this call a unique traceId. Only use this method for asynchronous calls. You have to call logAsyncClientReturn after using this method where you have to pass the RequestContext object returned by this method.- Specified by:
logAsyncClientCallin interfaceOpTraceLogger- Parameters:
calledObject- called object or called servlet/filter or database namecalledMethod- method called or request URL or SQL query- Returns:
- RequestContext used for the call to logAsyncClientReturn
-
logAsyncClientCall
public RequestContext logAsyncClientCall(String calledObject, String calledMethod, Object[][] optional) Description copied from interface:OpTraceLoggerEmit a asynchronous service invocation statement into the OP-TraceLog.- Specified by:
logAsyncClientCallin interfaceOpTraceLogger- Parameters:
calledObject- called object or called servlet/filter or database namecalledMethod- method called or request URL or SQL queryoptional- name/value pairs to be appended at the end of the log entry- Returns:
- RequestContext used for the call to logAsyncClientReturn
- See Also:
-
logAsyncClientReturn
Description copied from interface:OpTraceLoggerEmit the return from a asynchronous service invocation statement into the OP-TraceLog. Used to emit a log return if one returns from a service. Only use this method for asynchronous calls. You may have called logAsyncClientCall in advance an use the RequestContext returned by it.- Specified by:
logAsyncClientReturnin interfaceOpTraceLogger- Parameters:
rc- returned RequestContext by the corresponding logAsyncClientCallexception- optional object which represents an error condition (null on success)
-
logAsyncClientReturn
Description copied from interface:OpTraceLoggerEmit the return from a asynchronous service invocation statement into the OP-TraceLog.- Specified by:
logAsyncClientReturnin interfaceOpTraceLogger- Parameters:
rc- returned RequestContext by the corresponding logAsyncClientCallexception- optional object which represents an error condition (null on success)optional- name/value pairs to be appended at the end of the log entry- See Also:
-
isInfoEnabled
public boolean isInfoEnabled()Description copied from interface:OpTraceLoggerCheck if we should log responses- Specified by:
isInfoEnabledin interfaceOpTraceLogger- Returns:
- true if logging responses is INFO
-
isDebugEnabled
public boolean isDebugEnabled()Description copied from interface:OpTraceLoggerCheck if we should log responses- Specified by:
isDebugEnabledin interfaceOpTraceLogger- Returns:
- true if logging responses is DEBUG
-
isTraceEnabled
public boolean isTraceEnabled()Description copied from interface:OpTraceLoggerCheck if we should log transport details- Specified by:
isTraceEnabledin interfaceOpTraceLogger- Returns:
- true if logging responses is TRACE
-