Class RestDebugPipeline

java.lang.Object
org.apache.juneau.rest.server.logging.RestDebugPipeline

public class RestDebugPipeline extends Object
The request-completion half of the JUL-level-driven REST debug pipeline.

The request-start half is handled by RestContext/RestOpContext, which install bounded body-caching wrappers only when the resolved logger is loggable at FINEST. This class re-derives the cumulative tier from the resolved logger, renders a single cumulative message through the resolved RestDebugFormatter, and emits exactly one LogRecord:

  • tier INFO — formatBasic only.
  • tier FINE — +formatHeaders.
  • tier FINEST — +formatBody (from the cached bytes).
  • coarser than INFO (WARNING, SEVERE, OFF) — nothing is emitted.
The emitted record level is always Level.INFO; the resolved tier controls message detail only.
Since:
10.0.0
  • Method Details

    • emit

      public static void emit(RestSession session)
      Emits one debug record for the completed call on the synchronous request thread, if the resolved logger's effective level warrants it.

      This is the synchronous entry point: it resolves the logger/formatter/detail-tier now (the operation is already resolved by finish time) and renders/emits immediately. The emitted record is always stamped at Level.INFO; the resolved tier controls only which sections are rendered into the message body.

      Parameters:
      session - The completed REST session. Must not be null.
    • captureAsyncSnapshot

      public static void captureAsyncSnapshot(RestSession session)
      Resolves the logger/formatter/detail-tier snapshot for the given session and stashes it on the session for later completion-path emission.

      Called on the request thread at the async-dispatch handoff, before any completion callback is registered, so the immutable snapshot is safely published to the completion thread. Stashes null when access logging is off (no allocation), keeping emitOnCompletion(RestSession) a no-op in that case.

      Parameters:
      session - The REST session being handed off to async dispatch. Must not be null.
    • emitOnCompletion

      public static void emitOnCompletion(RestSession session)
      Emits one debug record for a completed asynchronous call on the response-completion thread.

      Reads the snapshot published on the request thread (via captureAsyncSnapshot(RestSession)), sets finish-time attributes (such as ExecTime) immediately before rendering, and renders from the final request/response state now that the async body and headers have been written. No-ops when no snapshot was stashed (access logging off). Any diagnostic-formatting failure is contained so it cannot disrupt request cleanup or async-context completion.

      Parameters:
      session - The completed REST session. Can be null (no-op).