Titanium api.info never shows anything in the console
Asked Answered
S

2

7

I've just started with titanium and I can't make the Ti.API.info("My log message") to print anything in the console.

I tried running the app in my Android device, in the Android Emulator, in the iPhone simulator and as a mobile web project in GoogleChrome, and the console window in Titanium Studio never prints my log message.

My last attempt was in the imported sample "Todo List". On the beginning of the file app.js I've added two log messages:

if (Ti.version < 1.8 ) {
    alert('Sorry - this application template requires Titanium Mobile SDK 1.8 or later');
}
else {
    Ti.API.error('my error');
    Ti.API.log('error','my error');

The app runs in the devices, in the emulators and in the browser, but this message is never shown.

I am using the latest version of Titanium Studio, the latest android SDK and xCode 4.2. Running on a Mac Os X 10.6.8.

Titanium Studio, build: 2.0.1.201204132053

I'll be glad to provide any other information that might indicate why this is not working.

Why this is not showing anything in the console?

Simonetta answered 23/5, 2012 at 16:39 Comment(4)
Try to put it outside the if/else state and see what you get.Stirps
The code is running, I can see it in the console in the browser but not in the Studio Console.Simonetta
clean the project then check the titanium console with all option enabled :)Henleyonthames
I had same problem on my windows machine, but on Mac it's actually showing, seems to be a bug in there...Rossetti
F
6
  • Go to Project -> Properties menu.
  • Select Run/Debug Settings on the left panel.
  • Click on Titanium iPhone Simulator - <your project name> on the list and than "Edit..." button.

There is "Log level" property on configuration properties "Platform" panel. Make sure that it's "Info", "Debug" or "Trace" to see Ti.API.info messages on console.

Clean your project and run it again.

Farquhar answered 24/5, 2012 at 13:55 Comment(2)
I don't have that there. I'll try to create a configuration.Simonetta
made no difference for me. did all these steps and still get no user-generated console output even though I do get the app-generated output when the project is building. i tried an alert instead and it fired. so i don't know what the heck is going on.Karlik
I
1

Is your console only showing red text? If so, you're displaying the wrong console (there are multiple ones in the Titanium IDE). There should be a drop down menu on the console. Try toggling through the options and searching through the outputs for your Ti.API.info message.

Iloilo answered 29/5, 2012 at 6:34 Comment(4)
Nope, there is nothing there. In all of them i can see the output for the build and deploy of the app, but during execution i get no messages. I have either to see the Logcat for android or the Browser Console for Mobile Web.Simonetta
You want to find the console for your Android Emulator Process. The output of Ti.API.info will have it's lines start off with "I/TiAPI". Select this console from the drop-down that this arrow points to. I've circled the correct console and output here as a reference. This is a screenshot of what I'm talking aboutIloilo
So Titanium can't keep track of the logs except if i'm running in the android emulator? Is it supposed to see the logs from the app running on a phone?Simonetta
Hmmm... I've never tried looking at logs while testing on an actual phone. I'm not entirely sure if you can. I can attest to them being there when you're running the emulator console though.Iloilo

© 2022 - 2024 — McMap. All rights reserved.