I have a simple kernel extension:
kern_return_t HelloWorld_start (kmod_info_t *ki, void * d) {
printf("Hello World\n");
return KERN_SUCCESS;
}
kern_return_t HelloWorld_stop (kmod_info_t * kid, void * d) {
printf("Goodbye World\n");
return KERN_SUCCESS;
}
Which I'm compiling and loading via:
sudo kextload HelloWorld.kext
And it appears in the kextstat listing:
...
129 0 0xffffff7f80fac000 0x4000 0x4000 com.apple.driver.AppleProfileThreadInfoAction (85.2) <123 6 4 3 1>
130 0 0xffffff7f80fb0000 0x4000 0x4000 com.apple.driver.AppleProfileTimestampAction (85.2) <123 5 4 3 1>
132 0 0xffffff7f807c6000 0x2000 0x2000 sk-r-d.HelloWorld (1) <4>
However, I have nothing in kernel.log (or system.log) - I should be seeing my printf() statements. Any idea why?
For some reason the console app doesn't seem to display printf messages from kexts, but the log console program does.
I've had success with the following magic words...
log stream --predicate 'eventMessage contains "YourMatchingPatternHere"'
This will produce a filtered stream showing only messages that match your predefined pattern.