Kernel logging

I am developing a kernel extension for macOS.



How can I read kernel logs after computer restart?



What is the best way for logging from kernel: printf, IOLog, os_log?

Answered by DTS Engineer in 266535022

How can I read kernel logs after computer restart?

After a standard restart? Or a hard restart (like a kernel panic)?

In the standard restart case the logs should be available via the usual tools (the Console utility and the

log
command line tool). If you hard restart then some log entries are going to get dropped because they get routed via the system’s user space logging infrastructure.

What is the best way for logging from kernel: printf, IOLog, os_log?

I generally recommend

os_log
for new code.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
Accepted Answer

How can I read kernel logs after computer restart?

After a standard restart? Or a hard restart (like a kernel panic)?

In the standard restart case the logs should be available via the usual tools (the Console utility and the

log
command line tool). If you hard restart then some log entries are going to get dropped because they get routed via the system’s user space logging infrastructure.

What is the best way for logging from kernel: printf, IOLog, os_log?

I generally recommend

os_log
for new code.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
Kernel logging
 
 
Q