Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adb Logcat to print only live traces

I am using following command which prints android device logs from connected device buffer in my desktop.

adb logcat

Now requirement is, i am running a test and want to see the output of current action in logs.

That is i need logs only since when i start logging command.

i don't want logs from the buffer or the logs prior to time when logging is started.

Also i don't want to clear the buffer using -c argument. because somebody (some other process) may need buffered traces during testing

adb logcat --live-trace

Thanks in advance for the help.

like image 414
Mani Vannan Avatar asked Sep 03 '25 03:09

Mani Vannan


1 Answers

From logcat's help:

-d                          Dump the log and then exit (don't block).
-T <count>                  Print only the most recent <count> lines (does not imply -d).

This would print a line and keep printing:

adb logcat -T 1

(Tested on Android version 12, may not work on older Android versions)

like image 148
Narcélio Filho Avatar answered Sep 07 '25 17:09

Narcélio Filho