views:

73

answers:

2

I've read the lame documentation, and checked other answers. I'd like my Android app to print some debug statements in the logcat window of Eclispe. If I use the isLoggable method on the various types of debug levels on the Log class, I find that WARN and INFO are returning true.

Log.w, and Log.i do not produce any output. Does anyone know which gotchas I've missed?

And just to vent, why should this be hard? I've published apps for iphone and bberry and while appreciate the use of java, the platform is reeking of too many "genuiuses" being involved. I suppose Activities and Intents are very flexible, but why? I just want to put up some screens, take some input and show some results. The bberry pushscreen and popscreen is a lot less pretentious.

Thanks, Gerry

+2  A: 

The problem with debugging with Android in Eclipse is that from Eclipse's point of view, you're debugging the emulator and not your specific app. The emulator isn't crashing, so there aren't any logs to show. What you need to use is LogCat, Android's debugging plug-in. See this answer for details on how to bring that up.

Steve H
The solution was revealed in the linked answer. Logcat will periodically disconnect from the process, and the only way to get it back is to exit eclipse and start it up again. Just to be clear, these tools are a lot less integrated than I'm used to, and that is not a good thing. Some "geniuses" will say it just that you don't know them well, and that is true, but I'm only trying to write code. I use visual studio, webgain, xcode, rim jde, and now this. Hidden gotchas are not cool.
Gerry
I found this quite frustrating as well
Casebash
+1  A: 

It is not clear to me what the problem is. I use "Log.d(TAG, "special message");" all the time in Eclipse in Android code running in the emulator. Since you say "Log.w" gives no output, I assume you already know about the need to import android.util.Log. Otherwise you would not have got even that far.

The only other thing I can think of is for you to check your Eclipse Preferences under Window>Preferences>Android>DDMS (DDMS is needed for Logcat). Make sure the timeout is reasonable (mine defaulted to 5000mS). Make sure the base local debugger port is open, too.

Matt J.
What I am finding is the from time to time the LogCat window stops receiving debug statements. To fix this I close and re-open eclipse. I was just a little lost the first time this happened.Thanks, Gerry
Gerry