Game Development Community

How do I read the iTBG console.log off iPhone?

by Warthog · in iTorque 2D · 12/08/2008 (11:31 am) · 15 replies

Hi all,

I hope this isn't too stupid a question, but how do I read the console.log generated by iTGB on the iPhone? I can read the console.log for the iPhone through the Xcode Organizer, but how can I read the console.log generated by iTGB that is in the iPhone? Please be specific, because I am an Xcode Newbie, still stumbling around!

(the reason I need to see this, is I am crashing the whole iPhone when I run the second level of my app and need to know what is choking the system)

Thanks for any help.

#1
12/08/2008 (12:11 pm)
@Warthog - I hope someone else is able to jump in, but I do not believe you are able to view the console log. You have to jump into the Organizer->Console and Organizer->Crash Log from XCode. I'm actually debugging a crash right now and that's what I have to do.
#2
12/08/2008 (12:22 pm)
@Michael - That would make debugging REALLY difficult, because right now nothing useful shows up in Organizer-Console and because I am crashing the whole iPhone, no crash log gets written to view in Organizer->Crash Log. Hopefully there is some way to do this. Could I divert where the iTGB console.log is saved? Where is that set? I can use Xcode's organizer to read stuff saved in the sandbox (Preferences). So saving the iTGB console.log to there might work?
#3
12/08/2008 (12:42 pm)
Hmmm...sounds feasible. I'll have to forward this on to the iTGB devs to see what they think. I'll see if they can post here so we have an answer on record.
#4
12/08/2008 (3:47 pm)
If you can telnet to the iPhone, you can watch the console via the telnet debugger. Might be more reliable than hoping the disk gets flushed before it dies.
#5
12/08/2008 (4:09 pm)
@Ben - How would I telnet to the iPhone, and how do I get the telnet debugger to show me the console.log? I've never had call to use telnet prior to this moment, so any detailed help here would be MOST appreciated.

Thanks.
#6
12/08/2008 (5:03 pm)
In standard Torque, there are several good tools (http://tdn.garagegames.com/wiki/TorqueScript/IDE/Guide). Torsion is what most people use.

The relevant class is TelnetDebugger in the engine - it should have docs on the protocol in its comments if you want to try working it by hand. Just to view the console shouldn't take much.

I have not developed with Torque on iPhone so you may find that the sandboxing prevents it from working, or that there are other security-related restrictions that make it not work. But you might have good luck setting up a simple listen server on your desktop/laptop and having the iPhone connect out and push log updates there. Obviously, if you can get the IDEs working, that would be best.
#7
12/08/2008 (8:52 pm)
It would be great to be able to dig the console.log . hope you guys find a way to do it.
#8
12/08/2008 (9:25 pm)
@Ben - Thanks for jumping in!

I highly recommend Ben's suggestion, as it is the most optimal method for debugging Torque in this situation. It's how Codeweaver and Torsion handle debugging after all.
#9
12/08/2008 (9:28 pm)
Warthog, How do you use xCode to read stuff from the sandbox? That could be very usefull by itself.
#10
12/08/2008 (10:49 pm)
@Eyal - When the iphone is connected, if you are in Xcode and open Organizer from the Windows menu, Then click the Summary tab. You will see a list of apps on your i phone. scroll to your app, then click the triangle next to it. That will reveal an item named Application Data. Click the arrow next to it and it asks you where you want to save the Application Data. This consists of anything you save in the Prefs or Documents folders or anything else you might have created in the sandbox. Right now it is empty (unless you've saved something like the state of your game etc), because the console.log is saved inside the app package and not in the sandbox.
#11
12/09/2008 (7:27 am)
Great. thank you.
Currently I'm only writing the saveGame data into this directory. but I suppose I can make another file that will somehow help me debug by writing usefull info into it. like when entering functions that I suspect are problematic. I know it's a very primitive way of debuging, but it's better than anything else I currently have :)
#12
12/11/2008 (6:37 pm)
Http://www.garagegames.com/mg/forums/result.thread.php?qt=79247
This thread has a method to debug via torsion. I've managed to get it to work on the Mac, but still haven't got it to work on the device. hopefully tomorrow.
My game is working perfectly when running via xcode "build and go", but if I run it from the iPhone icon it loads the mainMenuGui and crashes right after. so I'm really hoping to be able to debug it. I thought that I'm a week away from finishing my game. but I guess not.
#13
07/16/2009 (8:49 pm)
Being able to read console.log off the phone would be great for debugging but... iTGB doesn't actually write a file to the phone, does it? i mean, it's a pain (impossible?) to get to and i would imagine file I/O on the iPhone is really expensive, and what with TGB logging a ton of stuff when the app first starts and the app only having 35 seconds to start before Apple's OS kills it

i haven't tested any of this, it's just assumption, but the engine doesn't actually do any echos/writing to disk on the iPhone does it? If so, that's one part of the engine i might take out
#14
07/16/2009 (9:06 pm)
the only real way to read stuff from the iphone (thats not in private app folders because thats inaccessable by anything but the app) would be phoneview

but if you missassume that the console log will help you debug iphone crashes and alike you are at the total lose.
No chance it will help you.

Rely on XCode when running in debug instead of release mode for example.
#15
07/20/2009 (10:43 am)
Call enableDebugOutput(true); in your main.cs and you will be able to read all the iTGB output (what usually goes to console.log) from your XCode GDB output window, as it happens, not after the game ends. Those who are used to telnet debugging will know what I'm talking about. Just like if you had a non-iTGB app and used printf()s.

Debugging with Torsion on the device is possible(and oh so sweet), just make sure you enable the network and get the current ip form the system settings, I find that devices can connect and re-connect sporadically, I always check it just before I run to make sure.