Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trying to output my LogCat to a file

Tags:

android

logcat

I've been told it's a command line option. But Eclipse's Run!Run Configurations...!Target!Additional Emulator Command Line Options field is already occupied with

-sdcard "C:\android-sdk-windows\tools\sd9m.img"

If I wanted to write something like

adb logcat -s MessageBox > "C:\Users\me\Documents\LogCatOutput.txt"

then where do I write it, and how (i.e., is the syntax even correct)? I need to output only a filtered tag, not verbose. ("MessageBox" is my TAG. Again I don't know if any of this punctuation is right, or even where the command goes.)

Thanks for any help.

like image 829
user225626 Avatar asked Jun 30 '10 22:06

user225626


People also ask

How do I export from Logcat?

adb logcat –d > filename.txt This command will extract the logcat information from the connected device and redirects the output to a file on the PC. The option –d will take care that the output will stop when all output is flushed.

How do you write save a log into a file adb?

With a computer Type adb logcat -d > logcat. txt . This will save the log to logcat. txt .

What is Logcat output?

Logcat is a command-line tool that dumps a log of system messages, including stack traces when the device throws an error and messages that you have written from your app with the Log class. This page is about the command-line logcat tool, but you can also view log messages from the Logcat window in Android Studio.


2 Answers

There should be an adb.exe file in C:\android-sdk-windows\tools. You can invoke this manually from a DOS command prompt:

cd C:\android-sdk-windows\tools
adb logcat -s MessageBox > "C:\Users\me\Documents\LogCatOutput.txt"

There's no need to bother with Eclipse in this case.

like image 198
Trevor Johns Avatar answered Oct 26 '22 15:10

Trevor Johns


Alternatively, if you only want to dump whatever's already in the logcat buffers and exit immediately (useful for scripts), you can specify the -d option:

$ adb logcat -d -s MessageBox  > dump_file.txt

Make sure that '-d' is after 'logcat'.

like image 37
hopia Avatar answered Oct 26 '22 16:10

hopia