Android log combat - Bugreport log acquisition (14)

        Requirements: Connect the car to the U disk, and export the Bugreport to the U disk. At first, I searched for relevant information on the Internet, and there were many ways to generate and export BugReport. I felt that the function was very simple. Because there is a function of collecting logcat logs directly, the first thing that comes to mind is to write one in imitation.

1. Follow the logcat collection method

        Because there are related codes for logcat management in the project itself, first of all, try to obtain Bugreport by referring to the related codes of collecting logcat, the code is as follows:

log_path="/data/vendor"
stampDateTime="`date +%Y%m%d_%H-%M-%S`"

/system/bin/logcat -f ${log_path}/log/log_logcat@${stampDateTime}.log -r10240-n 30 -v threadtime &
/system/bin/bugreport -f ${log_path}/log/log_bugreport@${stampDateTime}.log -r10240 -n 10 -v threadtime &

        Running found that the bugreport related files cannot be generated, so this solution does not work.

Two, Bugreport acquisition

        Looking for information, you can find that Bugreport can get the compressed file of Bugreport log through bugreportz in shell mode.

1. Get Bugreport

adb shell bugreport

        The prompt command is obsolete, it is recommended to use bugreportz. But sometimes the log can be printed from time to time when used in the adb window, but most of the time it is not easy to use, and the prompt is outdated.

bugreportz</

Guess you like

Origin blog.csdn.net/c19344881x/article/details/131764265
log
log