Use logcat tool with -d
or -f
switch and exec() method.
Saving to a file on the host computer:
exec( "adb logcat -d > logcat.log" ) // logcat is written to logcat.log file on the host.
If you are just saving to a file on the device itself, you can use:
exec( "adb logcat -f logcat.log" ) // logcat is written to logcat.log file on the device.