1

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

Zerho
  • 1,440
  • 4
  • 19
  • 39

3 Answers3

7

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.

Parand
  • 102,950
  • 48
  • 151
  • 186
1

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?

Community
  • 1
  • 1
neteinstein
  • 17,529
  • 11
  • 93
  • 123
  • so even if I use titanium's method "Titanium.API.info("foo: " + foo);" i have to look through eclipse LogCat? it works, thanks, but what a dumb way :) – Zerho Jun 15 '11 at 14:05
1

Have you tried Ti.API.log?

rivenate247
  • 2,116
  • 2
  • 16
  • 18
  • yes but the problem is that i still need LogCat to see the log, and not one integrated on TiDev. i solved by installing ADT and DDMS on TiStudio,in this way works great, but i don't know how i could do while i will pass to iPhone dev too – Zerho Jun 15 '11 at 15:46
  • 1
    you can just build in xcode and watch the Ti.API.* live in the logs for iOS stuff on the devices – rivenate247 Jun 15 '11 at 16:44