Hook on to all system logs that have my app name in them

I'm looking for a way to have better logging for my iOS app. Right now, I have all of my own logging reported to a log file that the client can view. However, my information leaves out a lot of valuable data. I want to be able to hook onto the system logs to report those as well.


When i'm debugging with a device attatched to my computer, I use

idevicesyslog | grep MyAppName


Which gives me most, if not all of the information that I need.


I can see things like

kernel[0] : memorystatus: freezing (general) pid 6331 [MyAppName]...skipped (too much shared memory)

(something I never would have been able to find if I didn't have the system log for that device available to me)


However I don't know how to get that propegated to my client's log file so that when they need to report a bug, they can supply a proper log.


I'm pretty sure I would do this using `asl.h`, but from what I've read online it only would support querying for existing logs, not adding a delegate for when a new log message comes through.

Replies

There’s no way to do this. Back in the ASL days it was possible to get some of this information (with some significant caveats) but that’s not possible given the privacy focus of the new logging system.

Generally I recommend that folks log using the new logging system and then have customers take a sysdiagnose log when they have problems. That sysdiagnose log contains a copy of the system log, which includes your log messages and all the system log messages as well.

You can learn more about sysdiagnose logs on our Bug Reporting > Profiles and Logs page.

I also encourage you to file an enhancement request for an API-based solution to this problem. Providing such a solution would be trick, because of the afore-mentioned privacy concerns, but it’s still worth asking for.

Please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"