Viewing logs in the iOS simulator

oripessach

  • *
  • Posts: 259
I asked this in the customers only section, and got no response. Trying here because... Why not?

When I run a game on the iOS simulator, output from trace() statements and print blocks doesn't show up in the log. Is this a bug in Stencyl, the intended behavior, or something that I might be doing wrong?

If there's no way to view logs when running in the iOS simulator, shouldn't that be at least documented? My reading of the documentation is that this should work; in that case, is this a Stencyl bug?

Thanks,

Ori

rob1221

  • *
  • Posts: 9430
The logs should work on the simulator.  I don't know what would cause the logs to not show up though.

dtrungle

  • *
  • Posts: 1938
I don't know why it isn't showing up so I didn't know how to help. Since rob is baffled, I would say update xcode and/or the simulator, does Mac have 'run as admin' equivalent? Or do Macs have some sort of defender blocker?

Try this, click on test in simulator while the Log Viewer is open, it should take longer to compile but you'll see all the log prints. See if the load game logs appear, the info about screen size and loading scene.

oripessach

  • *
  • Posts: 259
None of the log messages that originate from the simulator, including the load game logs, show up in the log viewer when I test in the simulator. The compile messages do show up, however.

I have the latest version of Xcode (I update through the app store regularly) and the simulator updates along with Xcode.

Where is Log Viewer picking up the simulator's logs from? Is it from stdout? I believe that iOS simulator used to log to stdout, but that changed at some point. Is it possible that Log Viewer simply broke at that point and no one noticed?

dtrungle - when you run iOS Simulator,  do you see the logs?

dtrungle

  • *
  • Posts: 1938
I do see the logs.

After ** BUILD SUCCEEDED ** I get,
Running command : RUN
Usage of '--sdk' is deprecated in 3.x...
Timeout: 30 seconds
stdoutPath: /var/folders...
Then the game parameters appear.

oripessach

  • *
  • Posts: 259
OK then - where is the log viewer trying to get the iOS logs from?

oripessach

  • *
  • Posts: 259
Here's what I found: Stencyl doesn't run iOS simulator directly - it uses a utility called ios-sim. ios-sim accepts a command line argument, --stdout, to redirect stdout to a file. The file being redirected to by the lime/openfl/Stencyl dynamic trio is under /private/var/folders/ etc. etc. It's a long path, and if I remove the log file manually and run the simulator through Stencyl, it doesn't create a new one.

If I specify a log file under my home directory (by running ios-sim directly from the command line) I do get a log. So this seems to be a permissions problem, but I can't figure that out, since the directory ios-sim tries to write to is owned by my user, and I don't have any problems writing to it from the command line.

In any case, it looks like whatever Stencyl is doing in its current configuration isn't working.

oripessach

  • *
  • Posts: 259
Running ios-sim from the command line and passing different directories in --stdout, I can't get it to log anywhere under /private/var/folders.

dtrungle: it seems like your setup logs under /var, not /private/var. Any idea why there's a difference?