DriverKit logs not coming into Сonsole App

We created Driver sample by Xcode template and following macro was added into code:

#define Log(fmt, ...) os_log(OS_LOG_DEFAULT, "Driver - " fmt "\n", ##__VA_ARGS__)

We used this macro in init and start. For example:

bool ForcePlateDriver::init() {
    Log("init()");

But our logs are not displayed in Console app.

Did we miss something? Is anything else is required to have logs for Driver?

Our environment:
MacOS Monterey - 12.4 (21F79) Xcode - Version 13.4 (13F17a)

I’ve not tried this myself but the #1 cause of problems like this in other situation is folks failing to enable Info and Debug messages on the Action menu.

Share and Enjoy

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

@eskimo yep. Info and Debug options are enabled in Action.

We dug deeper and found that #include <os/log.h> in our Driver is DriverKit/usr/include/os/log.h not macOS's MacOSX.sdk/usr/include/os/log.h. So DriverKit's version has very limited API and declares following macro:

#define os_log(log, format, ...) __extension__({ \
    os_log_t _log_tmp = (log); \
    os_log_type_t _type_tmp = OS_LOG_TYPE_DEFAULT; \
    if (os_log_type_enabled(_log_tmp, _type_tmp)) { \
        OS_LOG_CALL_WITH_FORMAT(_os_log_impl, \
                (&__dso_handle, _log_tmp, _type_tmp), format, ##__VA_ARGS__); \
    } \
})

We created a new macro w/o check if (os_log_type_enabled(_log_tmp, _type_tmp)) and now see our logs in Console for kernel process. So it looks like OS_LOG_TYPE_DEFAULT is not enabled. What should we do to enable it?

So it looks like OS_LOG_TYPE_DEFAULT is not enabled.

Interesting.

What should we do to enable it?

I don’t know. If no one else chimes in, I recommend that you open a DTS tech support incident so that one of us (possibly even me :-) can research this properly.

Share and Enjoy

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

Is there any solution for this?

@NanoCarlos try to open Console.app and click Start. Next start(o tryr restart) your driver.

DriverKit logs not coming into Сonsole App
 
 
Q