Class StackTraceUtil


  • public class StackTraceUtil
    extends Object
    Helper class around outputting stack traces.
    Author:
    Derek Hulley
    • Constructor Detail

      • StackTraceUtil

        public StackTraceUtil()
    • Method Detail

      • buildStackTrace

        public static void buildStackTrace​(String msg,
                                           StackTraceElement[] stackTraceElements,
                                           StringBuilder sb,
                                           int maxDepth)
        Builds a message with the stack trace of the form:
            SOME MESSAGE:
               Started at:
                  com.package...
                  com.package...
                  ...
         
        Parameters:
        msg - the initial error message
        stackTraceElements - the stack trace elements
        sb - the buffer to append to
        maxDepth - the maximum number of trace elements to output. 0 or less means output all.