How to copy logcat output to clipboard?

試著忘記壹切 提交于 2019-11-27 08:33:14

Select the message and press ctrl+c. You can save it in a text file using this button:

If you are using mac a workaround is to right click, find similar messages, then copy from dialog. – Thank you Snicolas

You can click on the output line in LogCat and click [ctrl]+[c] like normal then a normal paste into whatever you want. You can use shift and click to select multiple lines.

Ctrl + C works but you need to make sure to make sure you click on the first line of any output that is split into multiple lines.

CCJ

Also notable is that as of at least ADT plugin version 21 there is a TID column displayed in Eclipse's logcat viewer when you have display settings on maximum verbosity, but the thread id will not be preserved if you copy and paste the content of this view. Instead you'll see something like [debug level] [timestamp] [invocation] (PID)... but no thread id. I don't know if there is an easier way to grab the TID data directly from eclipse, but it can be done using a remote adb shell as follows:

Execute the following from your PC's command line: adb -s [your device's serial number] shell "logcat -v threadtime" > [your_output_file]

your session will appear to hang, but in actuality the device's logcat output, exactly as shown in eclipse's logcat view including the TID, is being written in real time to your output file. When you want to view the content, exit the logcat dump process with ctrl+c and open the file on your PC. Other options for logcat filtering etc. can be found [here].1

From a command line:

adb logcat > log.txt

Copy only what is required in Android Studio

Out of the curiosity I thought to post this answer. By default Logcat shows other information also along with the logs like Date Time, Process and Threads, Package name and Tag and if you copy a line from Logcat then this whole information is copied as well.

In case you don't want this at all or you don't want a particular thing then you can do something like this,

Step 1:

Click on Logcat Header(Settings/Gear) icon

Step 2:

Untick whatever you don't want to see in the logs and ultimately you don't want to copy.

That's it.

I thought it might help someone.

P.S. The question is very old and asked at the time of Eclipse, but this answer is new and is for Android Studio.

For those of you working with Eclipse on a Macintosh, here's a work-around:

  • Highlight the parts of the logcat you want to copy to the clipboard (or just select everything by clicking ctrl-a when the logcat window is active)
  • Click on the "save" icon (it looks like a floppy disk)
  • Save it to a convenient location
  • Open the log file in another text editor (use your favorite that is NOT eclipse)
  • Select what you want
  • Now type ctrl-c to copy to the clipboard

Yup, I know; it's a pain in the ass, but it works.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!