Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to save LogCat contents to file?

I've added debug strings (using Log.d()) and want to see them in context from the contents of logCat. The "save" icon for LogCat has a "Save selected items" hint, but there's got to be a quick way to just save the entire contents, or select the entire contents, but I don't see how to do it.

like image 998
B. Clay Shannon-B. Crow Raven Avatar asked Nov 25 '11 03:11

B. Clay Shannon-B. Crow Raven


People also ask

Where is Logcat stored?

They are stored as circular memory buffers on the device. If you run "adb logcat > myfile" on your host system, you can retrieve the content into a file.

How can you use adb commands to store the device logs in a particular file?

Now, open Command Prompt in the expanded folder and execute the command adb devices, which will show you the connected devices. Then execute adb logcat > file. txt command. This will generate the ADB logs and the logs will be saved to the file.


3 Answers

To save the Log cat content to the file, you need to redirect to the android sdk's platform tools folder and hit the below command

adb logcat > logcat.txt

In Android Studio, version 3.6RC1, file will be created of the name "logcat.txt" in respective project folder. you can change the name according to your interest. enjoy

like image 143
Dinesh Prajapati Avatar answered Oct 16 '22 10:10

Dinesh Prajapati


Two ways to do what you want:

  1. Right-click in the logcat messages window, choose select all. Then your save will be all logcat messages in that window (including the ones scrolled out of view).
  2. When focus is in logcat messages window, type control-A, this will select all messages. Then save etc. etc.
like image 25
mwengler Avatar answered Oct 16 '22 11:10

mwengler


In addition to answer by Dinesh Prajapati, Use

 adb -d logcat <your package name>:<log level>

where -d is for device and you may also choose -e instead for emulator log and log level is a/d/i/v/e/w etc.

Now your command goes like:

adb -d logcat com.example.example:V > logfileName_WithPath.txt
like image 26
kAmol Avatar answered Oct 16 '22 10:10

kAmol