49

I'm developing android apps in eclipse and how can I get logcat messages to my clipboard?

royhowie
  • 11,075
  • 14
  • 50
  • 67
Guanlun
  • 1,598
  • 2
  • 18
  • 29
  • 8
    select and Ctl+c will copy then you can paste. if you need thru programatically check this: http://stackoverflow.com/a/8417757/1012284 – Padma Kumar Jul 23 '12 at 08:18

9 Answers9

57

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

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

Misha Akopov
  • 12,241
  • 27
  • 68
  • 82
Uriel Frankel
  • 14,304
  • 8
  • 47
  • 69
  • 4
    A workaround is to right click, find similar messages, then copy from dialog. – Snicolas Aug 02 '12 at 13:33
  • 2
    Mac is so fail compared to PC: the "Application" column doesn't copy!! not even when I saved the file :-C :-C :-C :-C – Someone Somewhere Apr 26 '13 at 22:54
  • A word of warning. If you use this to paste the text from a Log method into a search in Eclipse, and remove the stuff from the front of the string, you won't find a match. There is an invisible new-line character at the end of what you pasted in. Click on the end of the string in the search box, and press backspace. The last character does not disappear, because you have removed the new-line. Now your search will work. – Steve Waring Dec 04 '14 at 20:33
10

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.

Misha Akopov
  • 12,241
  • 27
  • 68
  • 82
Mike T
  • 4,747
  • 4
  • 32
  • 52
10

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.

Misha Akopov
  • 12,241
  • 27
  • 68
  • 82
Meanman
  • 1,474
  • 20
  • 17
4

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

enter image description here

Step 2:

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

enter image description here

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.

gprathour
  • 14,813
  • 5
  • 66
  • 90
2

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

Alex
  • 11,451
  • 6
  • 37
  • 52
CCJ
  • 1,619
  • 26
  • 41
2

From a command line:

adb logcat > log.txt
Red Baron
  • 63
  • 1
  • 6
1

Here is a technique for copying multiple data columns from Logcat, to paste in a spreadsheet.

Format your Log data with consistent padding (spaces, zeroes). Separate the data with tabs (tabs work with Google Sheets). Use a tag to filter the Logcat output.

Log.d("MY_TAG", String.format(Locale.ENGLISH, "value1, value2 %08d\t%03d", data1, data2));

After the app has produced some output, in the Logcat window hold down the ALT key, and drag down to select the columns.

select multiple Logcat columns

Use CTRL+C (Windows) to copy to clipboard.

Navigate to a spreadsheet (Google Sheets), select a starting cell, and use CTRL+V to paste the columns into the spreadsheet.

enter image description here

BlueSpectrumz
  • 279
  • 2
  • 6
0

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.

Misha Akopov
  • 12,241
  • 27
  • 68
  • 82
SMBiggs
  • 11,034
  • 6
  • 68
  • 83
0

put cursor in the logcat window. ctrl-a select all ctrl-c copy what's selected (which will be all) run vi then paste.

Misha Akopov
  • 12,241
  • 27
  • 68
  • 82
dcarl661
  • 177
  • 3
  • 9