All Downloads are FREE. Search and download functionalities are using the official Maven repository.

uw.task.util.Utils Maven / Gradle / Ivy

Go to download

uw-task包是一个分布式任务框架,通过uw-task可以快速构建基于docker的分布式任务体系,同时支持基于influx的任务运维监控。

The newest version!
package uw.task.util;

public class Utils {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
	}
	

	/**
	 * 打印异常信息,屏蔽掉spring自己的堆栈输出。
	 * @param e
	 * @return
	 */
	public static String exceptionToString(Exception e) {
		StringBuilder sb = new StringBuilder();
		sb.append(e.toString()).append("\n");

		StackTraceElement[] trace = e.getStackTrace();
		for (StackTraceElement traceElement : trace) {
			if (traceElement.getClassName().startsWith("org.spring"))
				continue;
			sb.append("\tat ").append(traceElement).append("\n");
		}
		Throwable ourCause = e.getCause();
		if (ourCause != null) {
			sb.append("CAUSE BY").append(ourCause.toString()).append("\n");
			trace = ourCause.getStackTrace();
			for (StackTraceElement traceElement : trace) {
				if (traceElement.getClassName().startsWith("org.spring"))
					continue;
				sb.append("\tat ").append(traceElement).append("\n");
			}
		}
		return sb.toString();
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy