FORUMS
Remove All Ads from XDA

[GUIDE]Providing a good logcat

4,549 posts
Thanks Meter: 11,243
 
By steadfasterX, Recognized Developer on 10th July 2018, 08:25 AM
Post Reply Email Thread
About

I know that there a lot of guides out there which help you in creating logcat reports.
As there are so many and not all are good I decided to create an own simple guide where I can refer to..


A) Windows & Linux: Log to a file (recommended way)

  • 1) Ensure you have adb set up on your PC, and have adb debugging and "developer options -> Root access -> ADB only" enabled or rooted the device otherwise
  • 2) open the adb shell:
    Quote:

    option A) when: developer options -> Root access -> ADB only is enabled:
    adb root
    adb shell

    option B) when: magisk/supersu installed:
    adb shell
    su

  • 3) The next step depends on what is needed:
    Quote:

    option A) when you want to create a oneshot only (e.g. needed to debug boot issues - so this must be done as soon as "adb shell" works) :
    logcat -b all -d > /sdcard/Download/logcat.txt

    Quote:

    option B) when you want to debug a specific Android issue (e.g. app crashes etc):
    logcat -c -b all
    logcat -b all > /sdcard/Download/logcat.txt
    now reproduce the issue
    when the issue occurred: CTRL + C in the terminal window

    Quote:

    option C) when you want to grab the full boot log (Linux / FWUL only):
    exit from "adb shell" screen. Reboot the device and once its powered down do this:

    when 2A) matches your setup:
    adb wait-for-device && adb root && sleep 1s && while true;do dmesg -c; done >> dmesg.log

    when 2B) matches your setup:
    adb wait-for-device && while true;do su -c dmesg -c; done >> dmesg.log

    now wait until Android has fully booted, login and when you see the Android Home screen:
    CTRL + C in the terminal window


    The log will be generated locally in the file dmesg.log and so you can skip step 4 and go on with 5

  • 4) grab the log:
    Code:
    adb pull /sdcard/Download/logcat.txt
  • 5) Share the content of this logcat.txt using https://paste.omnirom.org/ (ensure you select 1 month or 1 year in the drop down!)



B) Windows & Linux: Log to terminal window


Windows preparation

If the above fails for any reason you can also print the logcat output in the terminal window.


For this open the terminal and type:
Code:
mode con lines=32766
and ENTER. it sets the buffer in your terminal to the max possible which is needed due to the log verbosity.


Begin (Windows & Linux)
  • 1) Ensure you have adb set up on your PC, and have adb debugging and "developer options -> Root access -> ADB only" enabled or rooted the device otherwise
  • 2) open the adb shell:
    Quote:

    option A) when: developer options -> Root access -> ADB only is enabled:
    adb root
    adb shell

    option B) when: magisk/supersu installed:
    adb shell
    su

  • 3) The next step depends on what is needed:
    Quote:

    option A) when you want to create a oneshot only (e.g. needed to debug boot issues - so this must be done as soon as "adb shell" works) :
    logcat -b all -d

    Quote:

    option B) when you want to debug a specific Android issue (e.g. app crashes etc):
    logcat -c -b all
    logcat -b all
    now reproduce the issue
    when the issue occurred: CTRL + C in the terminal window

  • 4) copy the whole console output
  • 5) Share the copied console output using https://paste.omnirom.org/ (ensure you select 1 month or 1 year in the drop down!)



Trouble, connection or other issues

If you encounter any issues consider to try FWUL which is made for a stable and out-of-the-box working android connection

.
The Following 4 Users Say Thank You to steadfasterX For This Useful Post: [ View ]
 
 
10th July 2018, 08:26 AM |#2  
steadfasterX's Avatar
OP Recognized Developer
Thanks Meter: 11,243
 
Donate to Me
More
reserved
Post Reply Subscribe to Thread

Tags
dmesg, logcat, logging

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes