Guest User

Untitled

a guest
Jul 23rd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. } catch (Exception ex) {
  2. ex.printStackTrace(new PrintStream(yourOutputStream));
  3. }
  4.  
  5. catch(Exception e) {
  6. e.printStacktrace(System.out);
  7. }
  8.  
  9. StringWriter writer = new StringWriter();
  10. PrintWriter printWriter = new PrintWriter( writer );
  11. exception.printStackTrace( printWriter );
  12. printWriter.flush();
  13.  
  14. String stackTrace = writer.toString();
  15.  
  16. out = some stream ...
  17. try
  18. {
  19. }
  20. catch ( Exception cause )
  21. {
  22. cause . printStrackTrace ( new PrintStream ( out ) ) ;
  23. }
Add Comment
Please, Sign In to add comment