Java のテキスト ファイルに例外をキャプチャする必要があります。例えば:
try {
File f = new File("");
}
catch(FileNotFoundException f) {
f.printStackTrace(); // instead of printing into console it should write into a text file
writePrintStackTrace(f.getMessage()); // this is my own method where I store f.getMessage() into a text file.
}
を使用getMessage()
すると機能しますが、エラーメッセージのみが表示されます。printStackTrace()
行番号を含むすべての情報が必要です。