org.opends.server.loggers.debug
Class DebugStackTraceFormatter

java.lang.Object
  extended by org.opends.server.loggers.debug.DebugStackTraceFormatter

public class DebugStackTraceFormatter
extends java.lang.Object

A DebugStackTraceFormatter converts an exception's stack trace into a String appropriate for tracing, optionally performing filtering of stack frames.


Nested Class Summary
static interface DebugStackTraceFormatter.FrameFilter
          A FrameFilter provides stack frame filtering used during formatting.
 
Field Summary
static int COMPLETE_STACK
          The stack depth value to indicate the entire stack should be printed.
static DebugStackTraceFormatter.FrameFilter SMART_FRAME_FILTER
          A nested frame filter that removes debug and trailing no OpenDS frames.
 
Constructor Summary
DebugStackTraceFormatter()
           
 
Method Summary
static java.lang.String formatStackTrace(java.lang.StackTraceElement[] stackTrace, int maxDepth)
          Generate a String representation of the possibly filtered stack trace from the current position in executation.
static java.lang.String formatStackTrace(java.lang.Throwable t)
          Generate a String representation of the entire stack trace of the given Throwable.
static java.lang.String formatStackTrace(java.lang.Throwable t, int maxDepth, boolean includeCause)
          Generate a String representation of the possibly filtered stack trace of the given Throwable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMPLETE_STACK

public static final int COMPLETE_STACK
The stack depth value to indicate the entire stack should be printed.

See Also:
Constant Field Values

SMART_FRAME_FILTER

public static final DebugStackTraceFormatter.FrameFilter SMART_FRAME_FILTER
A nested frame filter that removes debug and trailing no OpenDS frames.

Constructor Detail

DebugStackTraceFormatter

public DebugStackTraceFormatter()
Method Detail

formatStackTrace

public static java.lang.String formatStackTrace(java.lang.Throwable t)
Generate a String representation of the entire stack trace of the given Throwable.

Parameters:
t - - the Throwable for which to generate the stack trace.
Returns:
the stack trace.

formatStackTrace

public static java.lang.String formatStackTrace(java.lang.Throwable t,
                                                int maxDepth,
                                                boolean includeCause)
Generate a String representation of the possibly filtered stack trace of the given Throwable.

Parameters:
t - - the Throwable for which to generate the stack trace.
maxDepth - - the maximum number of stack frames to include in the trace.
includeCause - - also include the stack trace for the cause Throwable.
Returns:
the stack trace.

formatStackTrace

public static java.lang.String formatStackTrace(java.lang.StackTraceElement[] stackTrace,
                                                int maxDepth)
Generate a String representation of the possibly filtered stack trace from the current position in executation.

Parameters:
stackTrace - - The stack trace elements to format.
maxDepth - - the maximum number of stack frames to include in the trace.
Returns:
the stack trace.