Reputation: 3183
In a Java-based Android application on a production device (USB debugging is enabled, so I can adb shell), I wrote a file something like:
BufferedWriter writer = new BufferedWriter(new FileWriter("log.txt"));
But I can't easily find the location of log.txt
. Where can I find it?
And a follow-up question: what is a recommended directory for such writing a log/debug file?
Upvotes: 1
Views: 552
Reputation: 1006564
Where can I find it?
You can't. Your code crashed, because you did not provide a fully-qualified path.
Use File
objects pointing to valid locations on internal storage or external storage.
what is a recommended directory for such writing a log/debug file?
Usually, we log to LogCat, using methods on the Log
class.
Upvotes: 1