OSLog messages not showing in system log

Since MacOS 14.4 I've been having trouble seeing logs emitted from my applications with oslog. For example:

#import <Foundation/Foundation.h>
#include <os/log.h>

int main(int argc, const char * argv[]) {
    @autoreleasepool {
        os_log_error(OS_LOG_DEFAULT, "Hello World!");
    }
    return 0;
}

When I compile and run this in Xcode I do see the log message in Xcode itself. But I'm not able to see anything with log stream --source --predicate "eventMessage contains 'Hello'" or the Console.app if I run the same program in Xcode or outside. I do see logs from other applications on the same machine so it's not completely down.

Any suggestions on how to debug this? Perhaps something missing in the project that would "enable" logging?

Replies

This is working on my Mac. I built your program as you described [1], ran it from Xcode, and saw the log entry in both Xcode and in Console. Here’s the one from Console:

type: error
time: 09:37:33.568449+0100
process: Test749662
category: <Missing Description>
message: QQQ Hello Cruel World!

This is Xcode 15.3 running on macOS 14.4 with a new project created from the macOS > Command Line Tool template.

Share and Enjoy

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

[1] Well, I tweaked the message string to make it easier to find.