In Android, How to capture or redirect the logs from LogCat to a file using ECLIPSE IDE. I dont want to use command prompt option. As i haven't configured it . Thanks
Asked
Active
Viewed 1.4k times
3 Answers
7
See logcat | Android Developers.
Can be redirected to file from the command prompt. Use adb logcat -f <filename>
, or in Linux it will be better adb logcat | tee <filename>
.
Also, you can capture the time stamp as well with
adb logcat -v time -f <filename>
, or in Linux it will be adb logcat -v time | tee <filename>
.
-
1yeah, except the stupid busybox or whatever crap that comes with android apparently doesn't have the tee command. – Michael May 16 '14 at 14:32
1
In the logcat view, to the right of the 'delete log' icon, is a pulldown (View menu), it brings up:
You can select the portion of log that you want, then use the "Export selection as text" option

NickT
- 23,844
- 11
- 78
- 121
-
The problem is since i have so much logging n it keeps updating i wont be able to select it during the runtime – m4n07 Apr 19 '11 at 11:51
-
At runtime bcoz of threads the logging screen gets updated very fast and after sometime i'm able to see only 2 lines in logcat. – m4n07 Apr 20 '11 at 14:05
0
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

tryer3000
- 829
- 10
- 14