System.Log vs NSLog Sierra Console

The logging system and changed dramatically in Sierrra ( see )

One interesting feature is that has various settings, such as:

  • show All Messages vs Errors and Faults (clickable buttons on the title bar)
  • Include Info Messages and Include Debug Messages options on the Action menu

I have two questions:

  • How do these options interact with visibility of logs made using Xojo’s System.Log levels (LogLevelInformation, LogLevelNotice, LogLevelWarning, LogLevelCritical etc.)
  • For a Cocoa app built with Xcode, what are the equivalent logging functions. Perhaps another way to ask the question is: “What does Xojo System.Log do under the hood?”

probably calling something like “DebugPrintf”, see below.

void DebugDisplay(const char *s)
#ifdef WIN32
    fprintf( stderr, "%s\
", s );
    fprintf( stderr, "%s", s ); // not seen in console, but seen in terminal
    if (_os_log_internal == NULL) {
        /*! @header
         * These routines are deprecated and replaced by os_log(3).  On OS versions
         * with os_log(3), the ASL routines for emitting log messages are shimmed into
         * the equivalent os_log functionality.  Functions whose deprecation messages
         * indicate they are unsupported will have no effect on OS versions with
         * os_log(3) support.
        aslmsg msg = asl_new(ASL_TYPE_MSG);
        asl_set(msg, ASL_KEY_READ_UID, "-1");
        asl_log(NULL, msg, ASL_LEVEL_NOTICE, "%s", s);
    } else {
        os_log(OS_LOG_DEFAULT, "%{public}s", s); // seen in console using desktop  <-------------------------------------

void DebugPrintf(const char *format, ...)
    const int BUF_SIZE = 2000;
    char buffer[BUF_SIZE];
    va_list pArguments;
    va_start(pArguments, format);
    vsnprintf(buffer, BUF_SIZE, format, pArguments);

What’s your point though? Yes we can filter out anything from all the messages that enter the by typing in the searchfield. The only thing that is important is where the arrow (see above), can provide extra security by limiting messages that can be read by others.

Oh, and NSLog sits on os_log and is (NSLog) only functional when compiled against cocoa (not all code for the cocoa platform is compiled against ObjC).

Thats way more complex than what it really does
We call the OS API on each target and let it handle things
Except Linux where fprintf to stderr is the right way

Well, I use NSLog even without Cocoa. You can simply pass in CFStringRef for first parameter.

Thanks for the input. I have an app which has both Xojo and XCode-built components, and prior to Sierra, my logging system worked the same on both apps. It seems as if in Sierra, that’s not the case, and I’m trying to figure out if this is user error (e.g. I don’t know how to use Console.log?) vs. an actual change in function in Sierra.

The problems I’m seeing:

  • xojo apps system.log calls don’t show up in the “Devices/MyComputerName” selection of Console.log but do show up when I switch to “System.log”
  • Xcode-built apps NSLog calls don’t show up in System.log but do show up in “Devices/MyComputerName”, but they are always the “normal” level (they don’t get the yellow “Errors & Faults” dot).

Basically, I’d like both my Xojo and Xcode apps to be able to have their log message show up in the same place, and make use of the distinction between “Info” vs. “Errors & Faults” messages.

Anyone figured out how to do that?