问题
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!
回答1:
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.
回答2:
You could just use the command line logcat utility: adb logcat
回答3:
Left click on a line, then CTRL + C to copy. If you wan the entire log, CTRL + A to select all, and then CTRL + C. Paste it anywhere you want.
回答4:
LogCat Rows are called items.
Each item has several attributes. Currently, you can only select one or more items and do the following things:
-Copy with ctrl+c
-Save to a text file using the save button.
来源:https://stackoverflow.com/questions/1950097/is-there-a-way-to-get-copy-and-pastable-debug-output-in-the-android-sdk-emulator