Interface OpTraceLogger

All Known Implementing Classes:
DefaultOptraceLogger

public interface OpTraceLogger
This class is used to do manual operation tracing (OP-tracing). The methods to emit log entries are pairs. If the first method of the call chain is entered one uses logInitialEnter to initialize the RequestContext and emit a log entry. If one leaves that method one uses logInitialReturn to delete the RequestContext and emit a log entry. For all other methods one uses logEnter and logReturn. If one calls another service (so one is client) logClientCall is used to extend the traceId to mark that call and to emit a log entry. If one returns from that call one uses logClientReturn to restore the traceId and to emit a log entry.
  • Method Details

    • getRequestContext

      RequestContext getRequestContext()
      Get the actually set RequestContext.
      Returns:
      actually set RequestContext or null if not set.
    • logInitialEnter

      void logInitialEnter(String traceId, String calledObject, String calledMethod, String principal, String clientId)
      Emit 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.
      Parameters:
      traceId - initial traceId for that request (received from e.g. reverse proxy)
      calledObject - called object or called servlet/filter or database name
      calledMethod - method called or request URL or SQL query
      principal - userPrincipal emitted in the log statement.
      clientId - id of client as received from front-end (e.g. reverse proxy) server or session ID
    • logInitialEnter

      void logInitialEnter(String traceId, String calledObject, String calledMethod, String principal, Object[][] optional, String clientId)
      Emit a service entering statement into the OP-TraceLog.
      Parameters:
      traceId - initial traceId for that request (received from e.g. reverse proxy)
      calledObject - called object or called servlet/filter or database name
      calledMethod - method called or request URL or SQL query
      principal - userPrincipal emitted in the log statement.
      optional - name/value pairs to be appended at the end of the log entry
      clientId - id of client as received from front-end (e.g. reverse proxy) server or session ID
    • logInitialEnter

      void logInitialEnter(String traceId, String calledObject, String calledMethod, String principal, Object[][] optional, String clientId, Object fullRequestContext, Object fullResponseContext)
      Emit a service entering statement into the OP-TraceLog.
      Parameters:
      traceId - initial traceId for that request (received from e.g. reverse proxy)
      calledObject - called object or called servlet/filter or database name
      calledMethod - method called or request URL or SQL query
      principal - userPrincipal emitted in the log statement.
      optional - name/value pairs to be appended at the end of the log entry
      clientId - id of client as received from front-end (e.g. reverse proxy) server or session ID
      fullRequestContext - injection point dependent data (e.g. the HttpServletRequest)
    • logClientCall

      void logClientCall(String calledObject, String calledMethod)
      Emit 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.
      Parameters:
      calledObject - called object or called servlet/filter or database name
      calledMethod - method called or request URL or SQL query
    • logClientCall

      void logClientCall(String calledObject, String calledMethod, Object[][] optional)
      Emit a service invocation statement into the OP-TraceLog.
      Parameters:
      calledObject - called object or called servlet/filter or database name
      calledMethod - method called or request URL or SQL query
      optional - name/value pairs to be appended at the end of the log entry
      See Also:
    • logClientReturn

      void logClientReturn(Object exception)
      Emit 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.
      Parameters:
      exception - optional object which represents an error condition (null on success)
    • logClientReturn

      void logClientReturn(Object exception, Object[][] optional)
      Emit a return from service invocation statement into the OP-TraceLog.
      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

      void logInitialReturn(Object exception, Object[][] optional)
      Emit 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.
      Parameters:
      exception - optional object which represents an error condition (null on success)
    • logAsyncClientCall

      RequestContext logAsyncClientCall(String calledObject, String calledMethod)
      Emit 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.
      Parameters:
      calledObject - called object or called servlet/filter or database name
      calledMethod - method called or request URL or SQL query
      Returns:
      RequestContext used for the call to logAsyncClientReturn
    • logAsyncClientCall

      RequestContext logAsyncClientCall(String calledObject, String calledMethod, Object[][] optional)
      Emit a asynchronous service invocation statement into the OP-TraceLog.
      Parameters:
      calledObject - called object or called servlet/filter or database name
      calledMethod - method called or request URL or SQL query
      optional - name/value pairs to be appended at the end of the log entry
      Returns:
      RequestContext used for the call to logAsyncClientReturn
      See Also:
    • logAsyncClientReturn

      void logAsyncClientReturn(RequestContext rc, Object exception)
      Emit 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.
      Parameters:
      rc - returned RequestContext by the corresponding logAsyncClientCall
      exception - optional object which represents an error condition (null on success)
    • logAsyncClientReturn

      void logAsyncClientReturn(RequestContext rc, Object exception, Object[][] optional)
      Emit the return from a asynchronous service invocation statement into the OP-TraceLog.
      Parameters:
      rc - returned RequestContext by the corresponding logAsyncClientCall
      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:
    • isInfoEnabled

      boolean isInfoEnabled()
      Check if we should log responses
      Returns:
      true if logging responses is INFO
    • isDebugEnabled

      boolean isDebugEnabled()
      Check if we should log responses
      Returns:
      true if logging responses is DEBUG
    • isTraceEnabled

      boolean isTraceEnabled()
      Check if we should log transport details
      Returns:
      true if logging responses is TRACE