Class StackTraceUtils


  • public class StackTraceUtils
    extends Object
    Utilities for examining stack traces at any point during program execution.
    Author:
    moskowitz
    • Method Detail

      • getCaller

        public static String getCaller()
        Name of caller for debug/trace/logging purposes.
        Returns:
        Information String about caller suitable for logging.
      • getCallers

        public static String getCallers​(int nBack)
        Names of callers for debug/trace/logging purposes.
        Parameters:
        nBack - how far up the stack to go (should be >=1)
        Returns:
        Information String about callers (up the stack) suitable for logging.
      • getCallersCompact

        public static String getCallersCompact​(int nBack)
        Names of callers for debug/trace/logging purposes.
        Parameters:
        nBack - how far up the stack to go (should be >=1)
        Returns:
        Information String about callers (up the stack) suitable for logging.
      • stackTraceToString

        public static String stackTraceToString​(Exception e,
                                                int nBack)