java运行期间打印方法调用栈



    		StringBuilder sb=new StringBuilder("");
    	   	Exception e = new Exception("hhhhhhhhhhhhhhhhhhh");
            StackTraceElement[] trace = e.getStackTrace();;
            for (int i=0; i < trace.length; i++)
            	sb.append("\tat " + trace[i]);
            logger.error("who invoke me\n"+sb.toString());


你可能感兴趣的:(java运行期间打印方法调用栈)