Save java agent exception to a document

Does anybody know how to if possible to store the java error shown with .printStackTrace();from a try catch to a notes document?

try {

}catch(Exception ex)

{

ex.printStackTrace(); // Save this to a notesdocument instead of printing it

}

/Fredrik

Subject: Yes, kind of.

You can use the other methods in the Exception object to read string data. Then use that data to store in a document.

For example:

getStackTrace()

getMessage()

However the nature of the exception is very important. If it is a NotesException thrown then attempting to write to a notes database without knowing why the exception was thrown can be dodgy.

From a debugging point of view, if it is a server agent you are better off writing it to the console. This allows you to review the console logs and look at what else was going on in the server.