os_log private not shown in Ventura

Lately, I've switched from NSLog to the new os_log. My problem is, whatever I try, I can't see the private values in my 13.6 (22G120).

My test line is trivial

os_log(OS_LOG_DEFAULT,"private shown: %@", [NSString stringWithFormat:@"OK"]);

and it prints (both in Xcode and in Console)

private shown: <private>

I did install in Settings the appropriate profile (as found here, copied down, changed just my company info) — in vain, it did not help, not even after restarting my computer. For the record, the profile is shown below.

Can anybody see what am I doing wrong and why it does not work? Thanks!

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>ConsentText</key>
	<dict>
		<key>default</key>
		<string>This will enable showing private strings and data in Unified Logs.</string>
	</dict>
	<key>PayloadContent</key>
	<array>
		<dict>
			<key>PayloadDisplayName</key>
			<string>ManagedClient logging</string>
			<key>PayloadEnabled</key>
			<true/>
			<key>PayloadIdentifier</key>
			<string>com.apple.system.logging.89AE58D8-0A4A-448B-8AE0-761DEE2D007F</string>
			<key>PayloadType</key>
			<string>com.apple.system.logging</string>
			<key>PayloadUUID</key>
			<string>89AE58D8-0A4A-448B-8AE0-761DEE2D007F</string>
			<key>PayloadVersion</key>
			<integer>1</integer>
			<key>System</key>
			<dict>
				<key>Enable-Private-Data</key>
				<true/>
			</dict>
		</dict>
	</array>
	<key>PayloadDescription</key>
	<string>Allows showing private log messages.</string>
	<key>PayloadDisplayName</key>
	<string>Allow Private Logs</string>
	<key>PayloadIdentifier</key>
	<string>cz.ocs.enable.private.logs</string>
	<key>PayloadOrganization</key>
	<string>OCSoftware</string>
	<key>PayloadRemovalDisallowed</key>
	<false/>
	<key>PayloadType</key>
	<string>Configuration</string>
	<key>PayloadUUID</key>
	<string>529DF49A-6CB3-4DE9-A29F-4C41EC88BFDD</string>
	<key>PayloadVersion</key>
	<integer>1</integer>
</dict>
</plist>
Answered by DTS Engineer in 771761022

I have a general discussion of this topic in Recording Private Data in the System Log. I also have a very specific example here. Between the two, I think you should have enough to get this working. Post back here if you continue to encounter problems.

Share and Enjoy

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

Accepted Answer

I have a general discussion of this topic in Recording Private Data in the System Log. I also have a very specific example here. Between the two, I think you should have enough to get this working. Post back here if you continue to encounter problems.

Share and Enjoy

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

Quinn,

thanks! Alas, I must be still doing something wrong, neither approach did help :(

  1. I've extended my test code to try both, the default and explicit subsystem, like this:
    os_log(OS_LOG_DEFAULT,"private shown: %@", [NSString stringWithFormat:@"OK"]);
    os_log_t withss=os_log_create("cz.ocs.CCC", "test");
    os_log(withss,"private-ss shown: %@", [NSString stringWithFormat:@"OK"]);
  1. I've removed my previous profile, copied down the profile from the end of your linked message, changed the system ID and display name, saved it as “syslog-CCC.mobileconfig”, installed as new profile in Settings. Installation went OK, looks like this:

Tested, still getting <private>, both in Xcode and Console, for both the logs. For reference, my slightly changed profile added completely at the end of this message. To make extra sure, I've tried also to install the profile verbatim with your original content (com.example.apple-samplecode.Test738648 etc); not surprisingly did not help either.

  1. I've added the first snippet (again with only change in the subsystem ID) to my “Info.plist”. Checked that it is indeed properly generated into the build:
1016 ocs /tmp> ~/Library/Developer/Xcode/DerivedData/CCC-aqmufkksnhojayaidbhwkprlyegv/Build/Products/Debug         
1017 ocs Build/Products/Debug> tail -14 CCC.app/Contents/Info.plist
	<string>NSApplication</string>
	<key>OSLogPreferenceso</key>
	<dict>
		<key>cz.ocs.CCC</key>
		<dict>
			<key>app</key>
			<dict>
				<key>Enable-Private-Data</key>
				<true/>
			</dict>
		</dict>
	</dict>
</dict>
</plist>
1018 ocs Build/Products/Debug> 

Still I am consistently getting <private> in all the cases :( Again, to make completely sure I am not missing something obvious, I've tried the same with your original com.example.apple-samplecode.Test738648 key and also with com.example.apple-samplecode.PrivateValueLogger, as shown in the detailed documentation; neither (not surprisingly) did help.

I am outta ideas. What could be wrong, what should I check? Thanks!

Almost forgot: macOS 13.6 (22G120), Xcode 15.0.1 (15A507), MacBook Air M1, 2020 (should be irrelevant, but who knows). I've restarted both Console and Xcode. I did not restart macOS (since I've got open work in other apps, not speaking of this message); I'll try that later and will add here the outcome.

Here's a complete contents of my slightly updated profile, as I've tested it:

1015 ocs /tmp> <syslog-CCC.mobileconfig 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>PayloadContent</key>
        <array>
                <dict>
                        <key>PayloadDescription</key>
                        <string>System Logging CCC</string>
                        <key>PayloadDisplayName</key>
                        <string>System Logging CCC</string>
                        <key>PayloadIdentifier</key>
                        <string>com.apple.system.logging.684C6584-DDFB-4DC5-AD4B-DF084028C248</string>
            <key>PayloadType</key>
            <string>com.apple.system.logging</string>
                        <key>PayloadUUID</key>
                        <string>684C6584-DDFB-4DC5-AD4B-DF084028C248</string>
                        <key>PayloadVersion</key>
                        <integer>1</integer>
            <key>Subsystems</key>
            <dict>
              <key>cz.ocs.CCC</key>
              <dict>
                <key>app</key>
                <dict>
                  <key>Enable-Private-Data</key>
                  <true/>
                </dict>
              </dict>
            </dict>
                </dict>
        </array>
        <key>PayloadDescription</key>
        <string>Enables logging for the CCC app.</string>
        <key>PayloadDisplayName</key>
        <string>CCC Enable Logging</string>
        <key>PayloadIdentifier</key>
        <string>Slimey.02BFD8E9-601F-40D3-96CF-8EA446D0ABD6</string>
        <key>PayloadRemovalDisallowed</key>
        <false/>
        <key>PayloadType</key>
        <string>Configuration</string>
        <key>PayloadUUID</key>
        <string>84BE502F-BB63-4D65-BBAF-64FCC31AA00A</string>
        <key>PayloadVersion</key>
        <integer>1</integer>
</dict>
</plist>
1016 ocs /tmp> 

Essentially solved. Sorry, I'm completely dumb and have messed up the categories; with

    os_log_t withss=os_log_create("cz.ocs.CCC", "app");
    os_log(withss,"private-ss shown: %@", [NSString stringWithFormat:@"OK"]);

it works all right, based on the profile installed. Also, with DEFAULT-OPTIONS category works all right for any category inside of the right subsystem. Whew!

Nevertheless, still

  • the Info.plist part still does not seem to work: whatever I set up in there yields <private>
  • is there a way to set up the profile so that OS_LOG_DEFAULT works? Xcode show the subsystem for my app as “CCC”, Console shows an empty string, but neither works (nor does its bundle identifier, which happens to be “cz.ocs.CCC”)
  • is there a way to set up Enable-Private-Data for more subsystems at once, without multiplicating the dictionaries? I did find DEFAULT-OPTIONS for categories, but I did not find anything like that for subsystems.

Thanks a lot and do please forgive my previous stupidity.

P.S. The option to store directly the options plist into “/Library/Preferences/Logging/Subsystems/” seems to work as well; is there some drawback to it, a reason why you suggest profile installation (which does essentially the same under the hood) instead?

Anyway, it sort-of solves my third question, for at least, in the folder I can set up as many subsystems as I want to through hard-links :) Though still, a way to set up “any cz.ocs.* subsystem” would be really handy, if possible somehow.

Hmmm, more questions (I do wonder what I am again overlooking), this time related to the levels. I've tried to play with the Level sub-dictionary. Not surprisingly, in Info.plist it does nothing. In a plist stored in ...Logging/Subsystems it sort of works, sort of; the log tool sees the setup:

248 root Preferences/Logging/Subsystems# <cz.ocs.CCCy.plist                     
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
              <dict>
                <key>DEFAULT-OPTIONS</key>
                <dict>
                  <key>Enable-Private-Data</key>
                  <true/>
<key>Level</key>
<dict>
<key>Enable</key>
<string>Default</string>
</dict>
                </dict>
              </dict>
</plist>
249 root Preferences/Logging/Subsystems# log config --status --subsystem cz.ocs.CCCy
Mode for 'cz.ocs.CCCy'  DEFAULT PERSIST_DEFAULT
250 root Preferences/Logging/Subsystems# 

The problem is, it does not seem to affect the logging at all. Whatever I set in there — I've tried all values from Default to Debug — the outcome is always the same:

  • the log tool properly shows whatever I set in there (meaning my dicts probably are not all wrong)
  • nevertheless, both Xcode and Console (when both Action/Include... are on) always print out all the message levels, including os_log_info and os_log_debug, regardless the current setting — even though Default is set up as shown above.

What am I overlooking now? The subsystem and category settings are all right, proved by that Enable-Private-Data works all right. The level setup seems OK too, given it is confirmed by log config --status. Nevertheless I can't see why neither Xcode nor Console are affected by the level settings the slightest bit?

os_log private not shown in Ventura
 
 
Q