When I develop android apps, I often find logging very hard. Not very hard to log the message, but very hard to see the logged message.
Maybe because I am using an actual phone to debug, the logcat is constantly filled with messages. I can switch the severity to "Error" so that there is less messages but then I can't see my "Info" message! Now the only way I can think of is to Log.e
instead of Log.i
. But that doesn't really make sense!
For example, I want to display the display metrics:
Point pt = new Point ();
getWindowManager ().getDefaultDisplay ().getSize (pt);
int height = pt.y;
int width = pt.x;
Log.i ("Display Metrics", "Height: " + height);
Log.i ("Display Metrics", "Width: " + width);
I can't find the message in the logcat because the messages keep coming. I can't even post the logcat here! How am I supposed to log stuff?
A few tips to help you work with Logcat: