views:

165

answers:

2

I have some information generated in the Android Emulator, and the only way I can see to get it out is using the Log class.

However, you cannot copy-and-paste from the DDMS log window. This is really annoying as I cannot use the information in another application, for example, without retyping it.

Is there a better way to get debug information out of the emulator? What happens when you write more complex applications? What do you do when you need to verify it is writing correct information to URLs, databases, files etc?

Thanks!

+3  A: 

Using the DDMS logcat window you can select lines and copy and paste text to other windows.

If you use java.util.logging instead of the Log class you could attach a handler to write the log file out to a text file if that would make things easier. Logcat is still available when using java.util.logging but by default INFO and above is only available.

Nic Strong
Thank you very much!!
Jumbo
+2  A: 

You could just use the command line logcat utility: adb logcat

Trevor Johns
You can use the adb logcat command and redirect all the device logs to a text file. You can also apply filters. For instance, if you wish to redirect all the Error messages to temp.txt, on windows you can say adb logcat *:E > tempfile.txt. For more info refer: http://developer.android.com/guide/developing/tools/adb.html#logcat
Samuh