Restarting macOS actually made this work. I suspect I had previously send pointer to bad data, which may have messed up some kext-related logging until restart. I haven't achieved clarity on when it stops working but sometimes, os_log from a kext reliably stops working.os_log_create also seems to reliably not work from a kext -- no subsystem or cateogry is passed with the associate message:os_log_t general_log = os_log_create("io.myname.test", "general");
os_log(general_log, "hi there");
IOLog("hello from cland v5");but$ log show --predicate 'senderImagePath contains "myname"' --last 5m --info --debug --style json
Filtering the log data using "senderImagePath CONTAINS "happy""
[{
"traceID" : 17081085460484,
"eventMessage" : "hi there",
"eventType" : "logEvent",
"source" : null,
"formatString" : "hi there",
"activityIdentifier" : 0,
"subsystem" : "", # <<<<<<< should not be empty
"category" : "", # <<<<<<< should not be empty
"threadID" : 89482,
"senderImageUUID" : "6CE18218-3F80-3215-A933-3F824337FC45",
"backtrace" : {
"frames" : [
{
"imageOffset" : 3883,
"imageUUID" : "6CE18218-3F80-3215-A933-3F824337FC45"
}
]
},
"processImagePath" : "\/kernel",
"senderImagePath" : "\/Users\/myname\/kext\/sample.kext\/Contents\/MacOS\/happymeowmeow",
"timestamp" : "2019-12-09 20:58:10.361445-0800",
"machTimestamp" : 2232376941776,
"messageType" : "Default",
"processImageUUID" : "DFB5D0E2-3B41-3647-A48B-D704AFCC06B4",
"processID" : 0,
"senderProgramCounter" : 3883,
"parentActivityIdentifier" : 0,
"timezoneName" : ""
Post
Replies
Boosts
Views
Activity
Hey eksimo,thanks for looking into this. I ran across this same issue today, while working on a fun kext project. Specifically, the code compiles, but I haven't been able to confirm that the log message ends up somewhere retrievable.I'm on:* macOS: 10.14.6 (18G1012)* XCode: Version 11.2.1 (11B500)* kext's macOS Deployment Target: 10.14I compiled a kext that contains:kern_return_t mydemo_start(kmod_info_t * ki, void *d)
{
const char * cStringVar = "Hello Cruel World!";
os_log(OS_LOG_DEFAULT, "%s", cStringVar);
return KERN_SUCCESS;
}kext seems to load fine, and it's displayed in kextstat, however log show --predicate 'eventMessage contains "Hello Cruel"' --info doesn't return any messages 😟.Any ideas?