Class DefaultOptraceLogger

java.lang.Object
swiss.trustbroker.common.tracing.DefaultOptraceLogger
All Implemented Interfaces:
OpTraceLogger

public class DefaultOptraceLogger extends Object implements OpTraceLogger
  • Constructor Details

    • DefaultOptraceLogger

      public DefaultOptraceLogger(org.slf4j.Logger logger)
  • Method Details

    • getRequestContext

      public RequestContext getRequestContext()
      Description copied from interface: OpTraceLogger
      Get the actually set RequestContext.
      Specified by:
      getRequestContext in interface OpTraceLogger
      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: OpTraceLogger
      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.
      Specified by:
      logInitialEnter in interface OpTraceLogger
      Parameters:
      traceId - initial traceId for that request (received from e.g. reverse proxy)
      object - called object or called servlet/filter or database name
      method - 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

      public void logInitialEnter(String traceId, String object, String method, String principal, Object[][] optional, String clientId)
      Description copied from interface: OpTraceLogger
      Emit a service entering statement into the OP-TraceLog.
      Specified by:
      logInitialEnter in interface OpTraceLogger
      Parameters:
      traceId - initial traceId for that request (received from e.g. reverse proxy)
      object - called object or called servlet/filter or database name
      method - 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

      public void logInitialEnter(String traceId, String object, String method, String principal, Object[][] optional, String clientId, Object fullRequestContext, Object fullResponseContext)
      Description copied from interface: OpTraceLogger
      Emit a service entering statement into the OP-TraceLog.
      Specified by:
      logInitialEnter in interface OpTraceLogger
      Parameters:
      traceId - initial traceId for that request (received from e.g. reverse proxy)
      object - called object or called servlet/filter or database name
      method - 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

      public void logClientCall(String calledObject, String calledMethod)
      Description copied from interface: OpTraceLogger
      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.
      Specified by:
      logClientCall in interface OpTraceLogger
      Parameters:
      calledObject - called object or called servlet/filter or database name
      calledMethod - method called or request URL or SQL query
    • logClientCall

      public void logClientCall(String calledObject, String calledMethod, Object[][] optional)
      Description copied from interface: OpTraceLogger
      Emit a service invocation statement into the OP-TraceLog.
      Specified by:
      logClientCall in interface OpTraceLogger
      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

      public void logClientReturn(Object exception)
      Description copied from interface: OpTraceLogger
      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.
      Specified by:
      logClientReturn in interface OpTraceLogger
      Parameters:
      exception - optional object which represents an error condition (null on success)
    • logClientReturn

      public void logClientReturn(Object exception, Object[][] optional)
      Description copied from interface: OpTraceLogger
      Emit a return from service invocation statement into the OP-TraceLog.
      Specified by:
      logClientReturn in interface OpTraceLogger
      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

      public void logInitialReturn(Object exception, Object[][] optional)
      Description copied from interface: OpTraceLogger
      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.
      Specified by:
      logInitialReturn in interface OpTraceLogger
      Parameters:
      exception - optional object which represents an error condition (null on success)
    • logAsyncClientCall

      public RequestContext logAsyncClientCall(String calledObject, String calledMethod)
      Description copied from interface: OpTraceLogger
      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.
      Specified by:
      logAsyncClientCall in interface OpTraceLogger
      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

      public RequestContext logAsyncClientCall(String calledObject, String calledMethod, Object[][] optional)
      Description copied from interface: OpTraceLogger
      Emit a asynchronous service invocation statement into the OP-TraceLog.
      Specified by:
      logAsyncClientCall in interface OpTraceLogger
      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

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

      public void logAsyncClientReturn(RequestContext rc, Object exception, Object[][] optional)
      Description copied from interface: OpTraceLogger
      Emit the return from a asynchronous service invocation statement into the OP-TraceLog.
      Specified by:
      logAsyncClientReturn in interface OpTraceLogger
      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

      public boolean isInfoEnabled()
      Description copied from interface: OpTraceLogger
      Check if we should log responses
      Specified by:
      isInfoEnabled in interface OpTraceLogger
      Returns:
      true if logging responses is INFO
    • isDebugEnabled

      public boolean isDebugEnabled()
      Description copied from interface: OpTraceLogger
      Check if we should log responses
      Specified by:
      isDebugEnabled in interface OpTraceLogger
      Returns:
      true if logging responses is DEBUG
    • isTraceEnabled

      public boolean isTraceEnabled()
      Description copied from interface: OpTraceLogger
      Check if we should log transport details
      Specified by:
      isTraceEnabled in interface OpTraceLogger
      Returns:
      true if logging responses is TRACE