如何将logcat输出复制到剪贴板?

时间:2021-01-09 14:01:54

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

我正在eclipse中开发android应用程序,如何将logcat消息发送到剪贴板?

6 个解决方案

#1


56  

Select the message and press ctrl+c. You can save it in a text file using this button:如何将logcat输出复制到剪贴板?

选择消息并按ctrl+c。你可以用这个按钮把它保存在一个文本文件中:

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

如果你使用的是mac,那么点击右键,找到类似的信息,然后从对话框中复制。——谢谢Snicolas

#2


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.

您可以单击LogCat中的输出行并像往常一样单击[ctrl]+[c],然后将一个普通的粘贴到您想要的任何内容中。您可以使用shift和单击来选择多行。

#3


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.

Ctrl + C可以工作,但是你需要确保你点击了任何被分割成多行的输出的第一行。

#4


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:

同样值得注意的是,至少在ADT插件版本21中,当您具有最大冗余度的显示设置时,在Eclipse的logcat查看器中会显示一个TID列,但是如果您复制并粘贴此视图的内容,则不会保留线程id。相反,您将看到类似于[debug level] [timestamp] [invocation] (PID)……但是没有线程id。我不知道是否有更简单的方法直接从eclipse获取TID数据,但是可以使用远程adb shell完成如下操作:

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

执行以下命令:adb -s[您设备的序列号]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

您的会话看起来会挂起,但实际上设备的logcat输出,正如eclipse的logcat视图(包括TID)所示,正在实时地写到您的输出文件中。当您想要查看内容时,使用ctrl+c退出logcat转储过程,并在您的PC上打开文件。logcat过滤等其他选项可以在这里找到。

#5


2  

From a command line:

从命令行:

adb logcat > log.txt

#6


0  

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

对于那些在苹果机上使用Eclipse的人来说,这里有一个工作:

  • 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)
  • 突出显示您想要复制到剪贴板的部分(或者在logcat窗口处于活动状态时单击ctrl-a选择所有内容)
  • 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)
  • 在另一个文本编辑器中打开日志文件(使用您最喜欢的不是eclipse)
  • Select what you want
  • 选择你想要的
  • Now type ctrl-c to copy to the clipboard
  • 现在键入ctrl-c复制到剪贴板

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

是的,我知道;这是很痛苦的事,但确实有效。

#1


56  

Select the message and press ctrl+c. You can save it in a text file using this button:如何将logcat输出复制到剪贴板?

选择消息并按ctrl+c。你可以用这个按钮把它保存在一个文本文件中:

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

如果你使用的是mac,那么点击右键,找到类似的信息,然后从对话框中复制。——谢谢Snicolas

#2


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.

您可以单击LogCat中的输出行并像往常一样单击[ctrl]+[c],然后将一个普通的粘贴到您想要的任何内容中。您可以使用shift和单击来选择多行。

#3


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.

Ctrl + C可以工作,但是你需要确保你点击了任何被分割成多行的输出的第一行。

#4


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:

同样值得注意的是,至少在ADT插件版本21中,当您具有最大冗余度的显示设置时,在Eclipse的logcat查看器中会显示一个TID列,但是如果您复制并粘贴此视图的内容,则不会保留线程id。相反,您将看到类似于[debug level] [timestamp] [invocation] (PID)……但是没有线程id。我不知道是否有更简单的方法直接从eclipse获取TID数据,但是可以使用远程adb shell完成如下操作:

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

执行以下命令:adb -s[您设备的序列号]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

您的会话看起来会挂起,但实际上设备的logcat输出,正如eclipse的logcat视图(包括TID)所示,正在实时地写到您的输出文件中。当您想要查看内容时,使用ctrl+c退出logcat转储过程,并在您的PC上打开文件。logcat过滤等其他选项可以在这里找到。

#5


2  

From a command line:

从命令行:

adb logcat > log.txt

#6


0  

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

对于那些在苹果机上使用Eclipse的人来说,这里有一个工作:

  • 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)
  • 突出显示您想要复制到剪贴板的部分(或者在logcat窗口处于活动状态时单击ctrl-a选择所有内容)
  • 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)
  • 在另一个文本编辑器中打开日志文件(使用您最喜欢的不是eclipse)
  • Select what you want
  • 选择你想要的
  • Now type ctrl-c to copy to the clipboard
  • 现在键入ctrl-c复制到剪贴板

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

是的,我知道;这是很痛苦的事,但确实有效。