Android: how to capture or redirect logs from LogCat to file using ECLIPSE IDE

On Android, how to capture or redirect logs from LogCat to a file using the ECLIPSE IDE. I do not want to use the command line option. Since I did not configure it. Thanks

+4
source share
3 answers

In the logcat view, to the right of the "delete log" icon, there is a drop-down menu ("View" menu), it calls:

enter image description here

You can select the part of the log that you want, then use the option โ€œExport as textโ€

+1
source

See logcat | Android developers .

It can be redirected to a file from the command line. Use adb logcat -f <filename> , or on Linux it will be better than adb logcat | tee <filename> adb logcat | tee <filename> .

Alternatively, you can also write the timestamp using adb logcat -v time -f <filename> , or on Linux it will be adb logcat -v time | tee <filename> adb logcat -v time | tee <filename> .

+6
source

use freopen to redirect stdout and stderr

the native code below works for me.

 // cachedir is get from java code 'Context.getExternalCacheDir().getAbsolutePath()' auto fullpath = cachedir + "/log"; freopen(fullpath.c_str(),"w",stderr); std::cerr << "hello, world\n"; // will write to file located at external storage 
0
source

All Articles