开发者

Android Log vs Titanium INFO

while programming android with eclipse, no matter if you're using the emulator or a 开发者_如何转开发device connected in debug mode you can easily check the Log for looking at the custom messages that you wrote.

e.g.: Log.i("foo: " + foo);

With the method:

Titanium.API.info("foo: " + foo);

if i'm using the emulator it all works fine, but if i'm deploying on the device is there a way of looking at the INFO?? with TiStudio or even TiDev

Thanks


You can use adb from the android SDK tools directory to see your Titanium Titanium.API.info calls:

tools/adb logcat | grep "TiAPI"

This will filter the adb log, giving you a cleaner view of only your log messages.


You can see logcat from the current device. Enable debug mode on the device, and connect it to the computer.

Then, if using eclipse, on the DDMS view on Devices select the device you want and the LogCat will show logs from it.

You can also see with this app the logs: https://market.android.com/details?id=org.jtb.alogcat

Or save them to file:

    try {
        File filename = new File(Environment.getExternalStorageDirectory()
                      + "/logfile.txt");
        filename.createNewFile();
        String[] cmd = new String[] { "logcat", "-v", "time", "-c", "-f",
                filename.getAbsolutePath() };
        Runtime.getRuntime().exec(cmd);
    } catch (IOException e) {
        Log.d("mCare", "Unable to log...", e);
        e.printStackTrace();
    }

You can read more here: How to redirect my log output from logcat to the SD-Card on an android device?


Have you tried Ti.API.log?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜