Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java print stacktrace to file

//printStackTrace() can accept PrintWriter or PrintStream as argument
catch (Exception e) {

    PrintWriter pw = new PrintWriter(new File("file.txt"));
    e.printStackTrace(pw);
    pw.close();
}

/*Credits: 
Stackoverflow Users: 
Less (https://stackoverflow.com/users/587318/less)
Qnan (https://stackoverflow.com/users/190670/qnan)*/
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #java #print #stacktrace #file
ADD COMMENT
Topic
Name
8+5 =