You could catch the error and retrieve the stacktrace from it:
StringWriter writer = new StringWriter();
myException.printStackTrace( new PrintWriter( writer ) );
stackTrace = writer.toString();
Then write it to a file.
HTH,
Pete
begin:vcard n:; x-mozilla-html:FALSE org:<BR><IMG SRC="http://www.irista.com/logo/irista.gif"><BR><BR><FONT Color=#000080><FONT SIZE=2><B>Bringing Vision to Your Supply Chain adr:;;;;;; version:2.1 end:vcard

