StackTraceElement[] stackElements = new Throwable().getStackTrace(); if(stackElements != null){ for(int i = 0; i < stackElements.length; i++){ String str = stackElements[i].toString(); if(str.contains("cn.kuwo")) { log.warn("---checkLogin---" + uid + "---" + sid + "---" + stackElements[i]); } } }