Any way to retrieve Debug and Info log messages remotely?

Note: I have read the Your Friend The System Log post, which was very helpful - thanks! I have a follow-up question.

I have added support in our app for reading the log messages via OSLogStore. However, as you mention, the Debug and Info level messages do not show up when we read messages when not connected to a debugger. You mention two ways on iOS to change this configuration:

  • Install a configuration profile created by Apple (all platforms). I assume all of these only work for the "com.apple.*" subsystems, correct? So this won't really work for 3rd-party apps like mine. Is this correct?
  • Add an OSLogPreferences property to your app’s Info.plist (all platforms). Is there any official documentation for the OSLogPreferences Info.plist key? I was not able to find any. Does the value of "OSLogPreferences" follow the same dictionary structure described here?

Thanks!

Eric

Replies

Update: I found a link which said that the "OSLogPreferences" key is a subsystem dictionary, as described here. So I added the follow key/value to my Info.plist:

       <key>OSLogPreferences</key>
       <dict>
               <key>com.noom.wlc</key>
               <dict>
                       <key>DEFAULT-OPTIONS</key>
                       <dict>
                               <key>Level</key>
                               <dict>
                                       <key>Enable</key>
                                       <string>Debug</string>
                                       <key>Persist</key>
                                       <string>Debug</string>
                               </dict>
                       </dict>
               </dict>
       </dict>

and was able to read Debug-level and Info-level messages using OSLogStore while NOT connected to a debugger. But clearly, this is not something I can change at runtime for a particular user, and we certainly don't want to enable Debug-level messages all the time. So that brings me back to whether or not I can have a particular user install a configuration profile of my making which will allow me to configure the Unified Logging system. Is this a possibility?

Thanks,

Eric

I presume we’re talking iOS and it’s child platforms here. The story for macOS is very different.

I assume all of these only work for the "com.apple.*" subsystems, correct?

At a technical level, no, this mechanism is subsystem agnostic. However, on iOS these profiles have to be signed by Apple, thus you’d have convince Apple to create a signed profile that changes the settings for your subsystem. There is no process in place to request that.

I see a couple of approaches you might use here:

  • Have the user trigger a sysdiagnose log and send that to you. That will capture recent volatile log entries.

  • Set up a TestFlight group for folks trying to help you debug issues and ship a variant of your app with OSLogPreferences to that group. Then, when a user offers to help you debug a problem that needs this logging, you can invite them to the group.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"