Android studio Save logcat Log Locally

  • 2021-12-04 11:02:29
  • OfStack

Under windows environment

1. Output logcat log to local file

adb logcat - > F:/logcat.txt

2. Output logcat log with time to local file:

adb logcat -v threadtime - > F:/logcat.txt

After entering the above command, adb automatically saves the logcat log to the command file, and presses ctrl + c to end the save.

Supplementary knowledge: Android real machine debugging does not print log

During the development of Android, sometimes log printing is obviously performed when debugging with a real machine, but the console just does not output, which may be because the log printing function of the mobile phone is not turned on (log printing will affect the performance of the mobile phone, so the manufacturer will turn it off by default)

Solution:

1. First condition: Turn on the developer mode (for mobile phones, click several times continuously at the version number)

2. Turn on log printing

Meizu mobile phone: settings-accessibility-developer options-performance optimization-advanced log output-all allowed

Huawei Mobile Phone: * # * # 2846579 # * # *-Background Settings-AP LOG Settings-Open


Related articles: