Search code examples
windows-7command-lineadb

Add timestamps to command output redirected to text file


I am writing adb logcat command output to the text file:

adb [-s device_id] logcat > logfile.txt

Unfortunately, in this case the logs don’t have timestamps. Is there way to just insert timestamps (or whatever text) at the beginning of each line of the redirected command output?

Update: I found that simply using logcat -v threadtime (example) is enough.


Solution

  • Decided to leave my own answer here, since I am not using the above suggestion anymore. The simpler way is just to use logcat -v threadtime, which ensures that logs have all the timestamps I need.

    [example]