[GUIDE]Providing a good logcat

Search This thread

steadfasterX

Recognized Developer
Nov 13, 2013
5,687
15,019
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

.
 
Last edited:

steadfasterX

Recognized Developer
Nov 13, 2013
5,687
15,019
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:
    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) :
    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

    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

    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

    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)





.-
 
Last edited:

steadfasterX

Recognized Developer
Nov 13, 2013
5,687
15,019
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:
    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) :
    option A) ONESHOT (e.g. to debug general issues. for boot issues go to option C instead) :
    logcat -b all -d -D

    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

    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

    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)


.-
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 6
    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

    .
    4
    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:
      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) :
      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

      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

      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

      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)





    .-
    2
    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:
      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) :
      option A) ONESHOT (e.g. to debug general issues. for boot issues go to option C instead) :
      logcat -b all -d -D

      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

      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

      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)


    .-
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone