/** * 打印方法路径 * @param type 0:方法开始,1:方法结束,2:方法异常,3:方法 */ public static void printMethodPath(String type){ Exception exception = new Exception(); try { if ("0".equals(type)){ type = "方法开始"; }else if("1".equals(type)) { type = "方法结束"; }else if("2".equals(type)) { type = "方法异常"; } else { type = "方法"; } //exception.getStackTrace()[0].getClassName():0为当前方法类名;1为调用者类名. Log.i(TAG,"Class———>:" + exception.getStackTrace()[1].getClassName() + exception.getStackTrace()[1].getMethodName() + type + " line:" + exception.getStackTrace()[1].getLineNumber()); } catch (Exception e) { e.printStackTrace(); FileLog.e(TAG,e.getMessage(),e); } }