public static void print(Exception e,PrintStream logger){
  if (logger != null) {
    StringWriter sw=new StringWriter();
    PrintWriter pw=new PrintWriter(sw);
    e.printStackTrace(pw);
    logger.println(sw.toString());
  }
}

public static void print ( Exception e , PrintStream logger ) { if ( logger != null ) { StringWriter sw = new StringWriter ( ) ; PrintWriter pw = new PrintWriter ( sw ) ; e . printStackTrace ( pw ) ; logger . println ( sw . toString ( ) ) ; } }
this method will take the typical output of printstacktrace and write it to the job console
