19

I'm using Console to debug iPhone 7

  • I am seeing <private> on most information. I am able to access Xcode simulator iPhone 7 device which does not show <private>. However I need to debug a passkit pass on the phone.

I think my devices development certificate is in keychain - am I being stupid?

How do you debug a real iPhone with access to full information ?

3 Answers 3

40

The detail is coming from Apple's Unified logging. If a debug message is a dynamic string, by default, <private> will be displayed.

In order for the data to print out the actual string, the string must be declared public when sent to logging. For example, in Swift this will display the text sent to the logger, as it's a static string:

static let logger = OSLog(subsystem: "com.company.myApp", category: "myCategory")
os_log(logger, "Some text that will display correctly");

However, this will display Some string: <private>

os_log(logger, "Some string: %s", "text that will display <private>")

In order for the text to display as expected, it would need to be declared with the public tag:

os_log(logger, "Some string: %{public}s", "text that will display as expected")

If you're simply looking at logs for 3rd party applications, then you're not going to be able to view the data, by default.

However, there are some that report that it is possible to see the redacted data with the log command line utility:

sudo log config --mode "private_data:on"

To my knowledge, this is not documented by Apple.

Post Catalina

Note that the above, undocumented switch was broken with the introduction of Catalina. However, it is now possible to reveal 'private' messages with a simple, signed configuration profile, as documented by Howard Oakley, here

10
  • Sorry, no. To my knowledge, this isn't available from php. Aug 31, 2017 at 13:12
  • 2
    Does that sudo log config --mode "private_data:on" work for you? I also need to debug some Apple's process logs such as apsd and this <private> makes it a lot more difficult.
    – Jan
    Sep 13, 2017 at 9:22
  • @Jan, it does. I just tried it with apsd; copied the line into Terminal and watched the output in Console, which changed to showing all data. Tested using the Developer Beta 9 of macOS 10.13 Sep 13, 2017 at 12:40
  • In my case, I'm trying to see the logs from iOS and not from a macOS app. Do you see the private logs from an iOS app?
    – Jan
    Sep 13, 2017 at 12:43
  • @Jan, sorry, I don't have an iOS device to test this. Sep 13, 2017 at 13:19
4

There is no single setting that you can change for iOS logging as there is for macOS.

If you are running a beta version of iOS, the private log information seems to be collected, so that is one option.

The other option is to see if there is a profile on this page that covers the logging you need.

Once you install the relevant profile you will see the previously <private> information appearing in the iOS console log.

In my case I was able to use the "Baseband" profile to enable caller id logging while working on a CallKit extension.

To disable the private logging you simply remove the profile from general settings on the device.

0

If you're jailbroken, you can create a plist at /Library/Preferences/Logging/com.apple.system.logging.plist with a bool key Enable-Private-Data set to TRUE.

See https://github.com/EthanArbuckle/unredact-private-os_logs for more information.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.