Unified Logging: App’s Info / Debug Messages Never Show Up In Logarchive File

1.3k views Asked by At

When deploying an app to my iOS device, triggering log collection via sysdiagnose, then exploring log messages in system_logs.logarchive obtained from iTunes sync, my app has never shown Info / Debug log messages type.

Please note that this question is different from existing but similar-sound questions like

I am using Paper Company (Swift) sample code from Apple to illustrate my problem. I start to deploy the app to my iOS device running iOS 11.0.3 as-is. The scheme is using Debug Mode. In my case:

  • I always have “Include Info Messages” and “Include Debug Messages” on in Console.
  • When I live stream my log messages while my app is running tethered to Xcode, I continue to see all log messages including Info and Debug types on Console.
  • When I trigger log collection via sysdiagnose and read through logarchive file with Console, however, I never see my app’s Info and Debug messages. Other messages types, Default, Error, and Fault, continue to show up like when I live stream.
    • However, I can still see Info and Debug messages that belong to other system processes, but not my app’s process.

Live Stream. Info / Debug are Shown Live Stream. Activity Tracing Working Logarchive. No Info / Debug for my App Logarchive. No Activity Tracing Logarchive. Info / Debug Shown for other Processes

Because of such puzzling behavior, I started to think that it might have to do with system’s configuration. In Logging documentation:

Info-level messages are initially stored in memory buffers. Without a configuration change, they are not moved to the data store and are purged as memory buffers fill. They are, however, captured in the data store when faults and, optionally, errors occur. When info-level messages are added to the data store, they remain there until a storage quota is exceeded, at which point, the oldest messages are purged. Use this level to capture information that may be helpful, but isn’t essential, for troubleshooting errors.

After reading that, I have also tried to change the Error type to Fault type, just for the sake of verifying that Info type messages will show up.

os_log("B-b-b-b-b-b-b-bomb !", log: ViewController.ui_log, type: .fault)  // previously .error

However, I still don’t see any Info log messages in logarchive file.

My questions:

  • Am I missing something that I need to set to make the logging behavior for sysdiagnose match the Console output I see when live streaming? Please note that Paper Company (Swift) already uses the ASSETCATALOG_COMPRESSION Build Settings, as has been pointed out as important to make os_log work as expected. See Read logs using the new swift os_log api
  • Is this an issue with Configuration Profile? In order to see Info / Debug messages from logarchive, do I actually need to add a custom profile like shown in Apple’s Logging doc and this mobleconfig example? It seems suspicious, however, given that even with Fault type, the Info messages still don’t get logged, and that I can still see Info / Debug messages from other processes.
1

There are 1 answers

0
jarrodparkes On

I had a similar issue where I thought my logs were not happening (even though they showed up fine in real-time when connected to a device), but it was because I was only viewing log statements from the last 5 minutes. Try changing the Showing: setting in Console and see if you can find the statements that way.

enter image description here