send printStackTrace() in the email body
807607Nov 13 2006 — edited Nov 13 2006we have a java class that has method for getting status information. Exception handling for this method prints printStackTrace(); We also have email sending routine in this class. I want to send ex.printStackTrace() to the message body. How can I do that? printStackTrace() is a void method and am not able to assign to the string variable. Please help with your suggestions. TIA.
code sample...
public class Helper {
public errmsg;
public String getStatus() {
init();
return status;
}
private void init() {
if (...) {
try {
...
} catch (Exception ex) {
ex.printStackTrace();
[want to do errmsg = ex.printStackTrace(); ]
}
}
}
}