I just checked some notes from a project (w/ KEXT, daemons, and agents) that targets 10.12. The project exclusively uses os_log both in kernel and user space. `sudo log config --mode 'private_data=on'` worked for me if I can trust my notes, although I was specific in noting to use `log stream --source --level debug` after turning on private data (instead of using Console.app, not sure if that matters?). I haven’t tested on 10.13 yet.
I don’t know how “private data” would be handled in calls to IOLog or printf. Maybe the xnu sources would shed light?
Thanks for the reply.
I've just checked on a minimal kext, and it doesn't work:
os_log_debug(OS_LOG_DEFAULT, "[os_log] addr=%llx", &kexttest_start);
Verification steps:
# log config --mode 'private_data:on'
# log config
System mode = INFO PRIVATE_DATA
# log stream --source --level debug --style=compact \
--predicate='eventMessage contains "[os_log]"'
...
... Db kernel[0:23c] (kexttest) < > [os_log] addr=<private>
...
^C
I suspect I might be doing something wrong, but I don't know what
exactly.
As a temporary solution, I've skipped os_log()'s filtering by using
sprintf() function, something like this:
int somevar = 10;
char buf[128];
sprintf(buf, "addr=0x%llx", &somevar);
os_log("%s", buf);
I've created my own function wrapper to perform logging and it seems to
work.
Also, I actually prefer the 'log stream' interface instead of Console.app,
because this new logging system seems to be partly broken in other ways
that seems to disqualify use of Console.app.
G.