Log info not working in Titanium

Leave a comment


When I was testing my Titanium App, suddenly the Log info on which I depend for testing the App, stopped working. Could not do anything.

Tried restarting the Emulator, Titanium Development Environment and even the Mac, but to no avail. Finally got the fix, by creating a new project and replacing the Resources Folder of my current project in to the newly created project.

Android – application debug logging

Leave a comment


Following content is referenced from

http://www.winksaville.com/blog/programming/debug-logging-in-android/

Here are a couple of places that got me started. First the standard java logging mechanism doesn’t work. In addition System.out.print doesn’t work. You need to use the android.util.log.

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;

@StateMachine
public class test extends Activity
{

/** Called with the activity is first created. */
@Override
public void onCreate(Bundle icicle)
{
super.onCreate(icicle);

Log.v(TAG, “onCreate: E”);
setContentView(R.layout.main);
Log.v(TAG, “onCreate: X”);
}

private static final String TAG = “test”;
}
The Log class supports various levels (VERBOSE, DEBUG, INFO, WARN, ERROR, ASSERT) the low-level routine is Log.println(int priority, String tag, String msg). But typically the v, d, i, w, e and a convince routines would be used. So that’s half the game, the other half is to be able to see the output. For that you use “logcat”. In Eclipse if you goto menu “Window/Show View/other/Android/logcat” or if your in the Debug perspective it will be in “Window/Show View/logcat”. Apparently, its not very reliable in Eclipse and executing:

adb logcat

Allows you to see it from a command line, but in Eclipse the log also includes a Date stamp which makes it nice. I was able to get the Eclipse/logcat going by closing than reopening. Of course you mileage may very:) If you look at the links above it appears you can use ddms, but I haven’t used that yet.