public void exception(Throwable e){
  StringWriter writer=new StringWriter();
  e.printStackTrace(new PrintWriter(writer));
  error(writer.toString());
}

public void exception ( Throwable e ) { StringWriter writer = new StringWriter ( ) ; e . printStackTrace ( new PrintWriter ( writer ) ) ; error ( writer . toString ( ) ) ; }
format and print a stack trace on the logger object . this calls the stacktrace directly , meaning underlying causes and other factors are included in the log . this is the equivalent of calling e . printstacktrace ( ) , but redirecting it to the logger object .
