StackTraceElement caller = Thread.currentThread().getStackTrace()[4]; String className = caller.getClassName();// 带有包名信息 className = className.substring(className.lastIndexOf(".") + 1); return className;
原文:http://www.cnblogs.com/BlogCommunicator/p/4987031.html