OT: How to fill what printStackTrace() output into a String? 2004-01-13 - By Ralph Einfeldt
Back How about:
ByteArrayOutputStream s = new ByteArrayOutputStream(); ex.printStackTrace(s); String str = s.toString();
(Havn't tried it)
> -- --Original Message-- -- > From: Chris Wahl [mailto:guoqian.wang@(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: tomcat-user-unsubscribe@(protected) For additional commands, e-mail: tomcat-user-help@(protected)
|
|