Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tail system.log for iPhone Simulator in Xcode 9

In Xcode 8 (and 7 maybe, I can't remember), the simulators would write their logs to ~/Library/Logs/CoreSimulator//system.log. Apps that were running on the simulators would write their "print" or NSLog output to this system.log file as well.

Now, in Xcode 9, the simulator logs still exist in those directories, but the application logs don't seem to be in the system.log file anymore. I can see it in the Xcode or AppCode output, but not in the file.

The reason I'm looking to get at the file through the filesystem (as opposed to using the console app), is that I want to grep and do other stuff with the files that you just can't do with the console app.

Does anyone know if/how to get application output for an app being run on a simulator to the system.log file in Xcode 9?

(Note, I don't think this has anything to do with OS_ACTIVITY_MODE as I'm interested in the app logs, and I can see the app logs in Xcode or AppCode console window).

like image 450
SuperDuperTango Avatar asked Jun 14 '26 14:06

SuperDuperTango


1 Answers

I finally ran across a blog that outlines what to do! For iOS12 (and likely 11, and maybe even 10).

log stream --level debug --predicate 'senderImagePath contains "<YourAppName>"' --style syslog

will get you the log. Then you can grep or whatever using unix pipes.

The original blog is here: https://fluentreports.com/blog/?p=545. Thanks @NathanA (not sure if he's a SO user though...)

like image 60
SuperDuperTango Avatar answered Jun 17 '26 13:06

SuperDuperTango