• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

e.printStackTrace();

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi ther,

i want to convert store stackTrace into a string is it possible if yes please let me kn
like String s = e.printStackTrace(PrintStream pout);
i kn the printStackTrace returns void but still i want to store the exception into a String.....
Please help me...

Rao
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rao,
Following Code will do the needful
StringWriter exception1=new StringWriter();
e.printStackTrace(new PrintWriter(exception1));
String exceptionInString = exception1.toString();
-Harneet Sachdeva
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Harneet --
Welcome to JavaRanch!
We don't have too many rules around here, but we do have our naming policy, which requires you to use a first and last name. Please head over here and fix yours, pronto. Thanks, pardner -- see you around the Ranch!
reply
    Bookmark Topic Watch Topic
  • New Topic