Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

send printStackTrace() in the email body

807607Nov 13 2006 — edited Nov 13 2006
we 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(); ]

}


}
}

}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 11 2006
Added on Nov 13 2006
5 comments
1,047 views