FORUMS
Remove All Ads from XDA

[GUIDE]Providing a good logcat

4,974 posts
Thanks Meter: 13,344
 
By steadfasterX, Recognized Developer on 10th July 2018, 09: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 one of them was good enough for my requirements I decided to create an own simple guide where I can refer to..


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

Follow Post #2


Alternative: Windows & Linux: Log to terminal window

Follow Post #3



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 6 Users Say Thank You to steadfasterX For This Useful Post: [ View ]
10th July 2018, 09:26 AM |#2  
steadfasterX's Avatar
OP Recognized Developer
Thanks Meter: 13,344
 
Donate to Me
More
RECOMMENDED: Windows & Linux: Log to a file
  • 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 (if you are not sure which one then it is likely option B) :
    Quote:

    option A) ONESHOT (e.g. to debug general issues. for boot issues go to option C instead) :
    logcat -b all -d -D > /sdcard/Download/logcat.txt

    Quote:

    option B) SPECIFIC ISSUE (e.g. app crashes etc. for selinux issues go top option D instead):
    logcat -c -b all
    (this will print nothing - it will just clear the log buffer)

    now reproduce the issue
    when the issue occurred:


    logcat -b all -d -D > /sdcard/Download/logcat.txt

    Quote:

    option C) FULL BOOT log (requires Linux / FWUL):
    exit from "adb shell" screen.
    Power off your phone and type in the the terminal:

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

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

    now power on your phone and 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 Linux (name: dmesg.log) and so you can skip step 4 and go on with 5

    Quote:

    option D) SELINUX (e.g. needed to debug selinux issues when in enforcing mode or if enforcing is what you want to achieve one day) :
    logcat -b main -e avc: > /sdcard/Download/logcat.txt

    if you have a specific issue reproduce it now or turn it on/off whatever not works atm.
    CTRL + C in the terminal window once you are finished

  • 4) exit from the adb shell & grab the log from your PC:
    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!)
    If for any reason paste.omnirom.org does not work for you then use on one of the billions other paste services.
    Here some examples: https://wiki.ubuntu.com/Pastebin

  • 6) Always share your model name (e.g. H811, H815, ...) and how you unlocked (official or e.g. by UsU)





.-
The Following 2 Users Say Thank You to steadfasterX For This Useful Post: [ View ]
23rd July 2019, 03:09 PM |#3  
steadfasterX's Avatar
OP Recognized Developer
Thanks Meter: 13,344
 
Donate to Me
More
ALTERNATIVE: Windows & Linux: Log to terminal window

Windows preparation

If the recommended way 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.
This 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 (if you are not sure which one then it is likely option B) :
    Quote:

    option A) ONESHOT (e.g. to debug general issues. for boot issues go to option C instead) :
    logcat -b all -d -D

    Quote:

    option B) SPECIFIC ISSUE (e.g. app crashes etc. for selinux issues go top option D instead):
    logcat -c -b all
    (this will print nothing - it will just clear the log buffer)

    now reproduce the issue
    when the issue occurred:


    logcat -b all -d -D

    Quote:

    option C) FULL BOOT log (requires Linux / FWUL):
    exit from "adb shell" screen.
    Power off your phone and type in the the terminal:

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

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

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

    Quote:

    option D) SELINUX (e.g. needed to debug selinux issues when in enforcing mode or if enforcing is what you want to achieve one day) :
    logcat -b main -e avc:

    if you have a specific issue reproduce it now or turn it on/off whatever not works atm.
    CTRL + C in the terminal window once you are finished

  • 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!)
    If for any reason paste.omnirom.org does not work for you then use on one of the billions other paste services.
    Here some examples: https://wiki.ubuntu.com/Pastebin

  • 6) Always share your model name (e.g. H811, H815, ...) and how you unlocked (official or e.g. by UsU)


.-
The Following User Says Thank You to steadfasterX For This Useful Post: [ View ]
23rd July 2019, 04:00 PM |#4  
steadfasterX's Avatar
OP Recognized Developer
Thanks Meter: 13,344
 
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