TheDarkKnight
TheDarkKnight

Reputation: 27631

Viewing info and debug logs from the Console application

I have a Swift 3 Cocoa application that uses Apple's Unified Logging, like this:

import os    
class MyClass
{
    @available(OSX 10.12, *)
    static let scribe = OSLog(subsystem: "com.mycompany.myapp", category: "myapp")

    func SomeFunction(){

        if #available(OSX 10.12, *){
            os_log("Test Error Message", log: MyClass.scribe, type: .error)
        }

        if #available(OSX 10.12, *){
            os_log("Test Info Message", log: MyClass.scribe, type: .info)
        }

        if #available(OSX 10.12, *){
            os_log("Test Debug Message", log: MyClass.scribe, type: .debug)
        }
    } 
}

Within the Console application, both Include Info Messages and Include Debug Messages are turned on.

enter image description here

When os_log is called, only the error type message is visible in the Console application. Using terminal, with this command, all message types are visible in the Terminal output:

`sudo log stream --level debug`

I've tried running the Console app as root, via sudo from the command line and the same issue occurs; no debug or info messages can be seen, even though they're set to being turned on under the Action menu.

Setting system-wide logging to be debug, has no effect on the Console application output:

sudo log config --mode level:debug

What am I missing and how can I view debug and info messages in the Console application?

Upvotes: 3

Views: 2257

Answers (1)

TheDarkKnight
TheDarkKnight

Reputation: 27631

Apple responded on their Developer forums and confirmed that they have repeated this issue on 10.12.5, so it is is a bug in the OS.

A bug report was filled for the upcoming 10.13 Developer Preview and has been fixed in 10.13 version3 (17A306f)

Upvotes: 5

Related Questions