1

i use some batch script for android device , it should clear The device log , start and close an apk and then take the log out of it. thats my code i use:

adb -s %DeviceId% logcat -c

adb -s %DeviceId% shell am start -n com.mv4d.sdktutorialbasicchangeframesize/com.mv4d.sdktutorialbasicchangeframesize.MainActivity
SLEEP 80
adb -s %DeviceId% shell am force-stop com.mv4d.sdktutorialbasicchangeframesize

adb -s %DeviceId% logcat -d -v  time >  D:\Roey\Jen2\ChangeFrameSize\Results\Logcat\AndroidLog.txt

the created log is missing lot of first and last lines. (that appears if you start the app and check the live log via android studio for example...) any ideas ?

Jaxian
  • 1,146
  • 7
  • 14
Roey Cohen
  • 329
  • 2
  • 5
  • 17
  • 1
    `logcat` buffers are circular. you can either increase the size or just capture the live log during the run instead of dumping the buffer afterwards – Alex P. Jul 07 '16 at 14:40
  • how can i perform each one of the operations you mentioned ? – Roey Cohen Jul 10 '16 at 06:28

1 Answers1

1

adb logcat -d [file] will only dump the logs currently in memory, not all logs since the device boot.

The logs stored by LogCat are circular, which means that when the allocated space for logs starts to run out, LogCat with delete older logs to make space for newer logs. That means you can only have a certain number log lines in memory at any given time (usually set to something like 16kb).

To be able to get all logs you will have to make LogCat write logs out to a specific file, instead of just keeping them in memory.

You can do this with the following command:
adb logcat -f [file].

This will make LogCat write out any log in memory and any future log to the specified file.

NOTE: The specified file must be on the device itself and can be pulled from the device.
(adb pull [device file] [destination file])

Bam
  • 478
  • 6
  • 19