package com.rongwei.bscommon.sys.utils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;

/**
 * @author zhou
 */
public class ExceptionUtils {

    private static final Logger logger = LoggerFactory.getLogger(ExceptionUtils.class);

    /**
     * 打印完整异常通用方法
     * @param des
     * @return
     */
    public static void printExceptionDetail(Exception e,String des) {
        e.printStackTrace();
        ByteArrayOutputStream errorDetail = new ByteArrayOutputStream();
        e.printStackTrace(new PrintStream(errorDetail));
        String exception = errorDetail.toString();
        logger.error(des + exception);
    }
}
