Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to inject a message into logcat via adb

Tags:

android

Is there a way to inject a message into the logcat buffer via adb? This could be useful if for testing and development.

(SO requires me to write more here, so I am writing more here (ignore this line)).

like image 565
Jo Jo Avatar asked Aug 31 '16 17:08

Jo Jo


1 Answers

Use the device-side 'log' command. Example:

adb shell log -t my_tag "About to send broadcast..."

The result in logcat will look like:

08-31 10:33:18.750  7081  7081 I my_tag  : About to send broadcast...
like image 116
Jo Jo Avatar answered Sep 20 '22 09:09

Jo Jo