[HTC Sensation] frankinstine:
Info/How To...Logcats,Dmesg,last_kmsg By:Indirect

There has been a lot of disappointing posts all over the forum with people complaining about bugs, while not providing any kind of information for the developers aside from "X doesn't work" or "I get random reboots".

Well, without the proper knowledge, how are we going to fix it? We don't know what kernel you may be running, what version number you're on, or any information that the system spits out to let you know there's an error. So, I decided to start this thread, to hopefully teach newbies how to give us (developers) proper knowledge when complaining about issues.

This thread will have 3 sections, Logcat (App / system debug log.), Dmesg (active kernel output) and last_ksmg (Typically if you get a random reboot or something of that sort {this is the same as dmesg except it gets the info from the last shutdown [like a kernel panic]})

Section 1: Logcat

This log should almost always be included just because it provides more info than just saying something doesn't work. It will essentially tell you which apps are crashing and why and it also gives output of what they're doing. (Your system is running through apps, the dialer, wireless radio's, etc are all ran through apps.) so, if something is general, like a system force close, please just include a logcat.

How to get a logcat:

Well, this is REALLY simple, all you need to do is just get adb up and running (google how to do that, I don't feel like writing a 'how to use adb' tutorial for everyone's phone.) and then type

adb logcat

then you just right click, select, and paste to the thread. It's really that simple!

Section 2: Dmesg

This is getting into issues such as wifi not working, sleep of death, etc. Basically, things that make us go "OH F***" when we use our devices. Note: You will need adb access for this to work, same as logcat.

What this will do is get us live kernel output so we can know things like "What driver is the kernel loading {or not loading for that matter}" and similar things. This is linux, so kernel output is important if a hardware aspect isn't working right.

How to get a dmesg:

This is simple as well, no matter what operating system you're on (mac, windows, linux) just type

adb shell dmesg > dmesg.txt

and then it will have written the output to a .txt file in your current directory. Either paste the contents to the thread, or attach it to your post.

You can also get the dmesg by using terminal emulator. Instead though, you dont type adb shell, you need to also include it to somewhere you will be able to save it. Like /sdcard so, the command goes

dmesg > /sdcard/dmesg.txt

Just get it off your sdcard and get the contents to the developer!

Section 3: last_kmsg

Ok, the last thing is last_kmsg. When android kernels crash, they right to last_kmsg so then you can find out what's going on. This is usually for issues such as random reboots and other various kernel panic symptoms. A kernel panic happens when the kernel tries to do something it can't. It doesn't mean wrong permissions, it could just have errored out on something and died which can cause a few things. Anyway, developers REALLY need this if debugging a kernel because it gives us a viable way to see WHAT it's trying to do instead of trying to guess what it is trying to do

How to get a last_kmsg:

This is super simple and the same on all phones no matter what, what you need is adb up and running (or terminal emulator) and either in adb shell, or terminal emulator just type

cat /proc/last_kmsg > /sdcard/last_kmsg.txt

or you can do

adb shell cat /proc/last_kmsg > kmsg.txt

and that will write it to your current working directory from cmd.

Hopefully, this way we developers can have our lives be a little bit easier and you can learn more about android.

I'm glad to have written this and devs, feel free to link to this guide as a "bug reporting FAQ"

Or try this http://xdaforums.com/showthread.php?p=30344895