Class TracingLogger.TracingLoggerImpl

java.lang.Object
org.glassfish.jersey.message.internal.TracingLogger
org.glassfish.jersey.message.internal.TracingLogger.TracingLoggerImpl
Enclosing class:
TracingLogger

private static final class TracingLogger.TracingLoggerImpl extends TracingLogger
Real implementation of tracing logger.
  • Field Details

  • Constructor Details

  • Method Details

    • isLogEnabled

      public boolean isLogEnabled(TracingLogger.Event event)
      Description copied from class: TracingLogger
      Test if a tracing support is enabled (according to propertiesDelegate setting) and if event can be logged (according to event.level and threshold level set).
      Specified by:
      isLogEnabled in class TracingLogger
      Parameters:
      event - event type to be tested
      Returns:
      true if event can be logged
    • log

      public void log(TracingLogger.Event event, Object... args)
      Description copied from class: TracingLogger
      Try to log event according to event level and request context threshold level setting.
      Specified by:
      log in class TracingLogger
      Parameters:
      event - event type to be logged
      args - message arguments (in relation to .Event#messageFormat()
    • logDuration

      public void logDuration(TracingLogger.Event event, long fromTimestamp, Object... args)
      Description copied from class: TracingLogger
      Try to log event according to event level and request context threshold level setting. If logging support is switched on for current request and event setting the method computes duration of event and log message. If fromTimestamp is not set (i.e. -1) then duration of event is 0.
      Specified by:
      logDuration in class TracingLogger
      Parameters:
      event - event type to be logged
      fromTimestamp - logged event is running from the timestamp in nanos. -1 in case event has no duration
      args - message arguments (in relation to .Event#messageFormat()
    • timestamp

      public long timestamp(TracingLogger.Event event)
      Description copied from class: TracingLogger
      If logging support is switched on for current request and event setting the method returns current timestamp in nanos.
      Specified by:
      timestamp in class TracingLogger
      Parameters:
      event - event type to be logged
      Returns:
      Current timestamp in nanos or -1 if tracing is not enabled
    • flush

      public void flush(javax.ws.rs.core.MultivaluedMap<String,Object> headers)
      Description copied from class: TracingLogger
      Stores collected tracing messages to response HTTP header.
      Specified by:
      flush in class TracingLogger
      Parameters:
      headers - message headers.
    • logImpl

      private void logImpl(TracingLogger.Event event, long duration, Object... messageArgs)
      Log message for specified event type. The event contains name, category, level and also message format. Message format will be formatted by parameter messageArgs is used to format event. If there is no message format then each message arg is separated by space. Final message also contains event name (JDK Log) or category (HTTP header) and time stamp.
      Parameters:
      event - Event type of log
      duration - Time duration of logged event. Can be 0.
      messageArgs - message arguments
    • isEnabled

      private boolean isEnabled(TracingLogger.Level level)
    • formatInstance

      private static String formatInstance(Object instance)
      Format info of instance. It shows its class name, identity hash code, and following info if available: priority value, response detail.
      Parameters:
      instance - instance to be formatted
      Returns:
      Formatted info of instance.
    • formatInstance

      private static void formatInstance(Object instance, StringBuilder textSB)
      Basic format of instance - just class name and identity hash code.
      Parameters:
      instance - instance to be formatted
      textSB - Formatted info will be appended to StringBuilder
    • formatResponse

      private static void formatResponse(javax.ws.rs.core.Response response, StringBuilder textSB)
      Format of response - status code, status family, reason phrase and info about entity.
      Parameters:
      response - response to be formatted
      textSB - Formatted info will be appended to StringBuilder
    • formatStatusInfo

      private static String formatStatusInfo(javax.ws.rs.core.Response.StatusType statusInfo)