androidadblogcat

logcat: couldn't open output file '/storage/logFile.txt': Permission denied


How to get permission to save logcat history as file?

Tried: ./adb logcat -f /storage/logFile.txt logFile.txt already exist឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵ ឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵ ឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵ ឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵ ឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵ ឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵ ឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵ ឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵ ឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵ ឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵឵


Solution

  • I assume you have a PC (or Mac) and an Android device connected via adb (e.g. USB) to the PC

    If you execute adb logcat on your PC then the command you execute is adb hence if you redirect standout to a file you need to use a path on your PC not on your phone.

    If you want to save the logcat output on your phone you need to open a shell, execute logcat there and then redirect the output to a file:

    adb shell "logcat -f /storage/logFile.txt"