package com.emr.util;

import org.apache.log4j.Logger;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;

public class ExceptionPrintUtil {
    private static Logger log = Logger.getLogger("errorMsg");
    public static void printException(Exception e){
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        e.printStackTrace(new PrintStream(baos));
        String exception = baos.toString();
        log.error(exception);
        try {
            baos.flush();
            baos.close();
        } catch (IOException e1) {
            e1.printStackTrace();
        }
    }
}
