How about: ByteArrayOutputStream s = new ByteArrayOutputStream(); ex.printStackTrace(s); String str = s.toString();
(Havn't tried it) > -----Original Message----- > From: Chris Wahl [mailto:[EMAIL PROTECTED] > Sent: Tuesday, January 13, 2004 2:16 PM > To: Tomcat Users List > Subject: How to fill what printStackTrace() output into a String? > > > Hi, all > > I want to get the exception stack trace and I 'd like to use a > String to contain the info, How can I do? > > I am thinking about this: (ex is an instance of Exception ) > > PrintStream trace = new PrintStream(); > ex.printStackTrace(trace); > String str = doSomeThing (trace); > > Then how to write the function doSomeThing() ? > > Is there any elegance solution? > > TIA > Chris > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
