Logger messages not showing in XCode console

XCode version 13.2.1

I enabled os_log messages using the following code:

   let myLog = OSLog(subsystem: "testing", category: "exploring")

  override func viewDidLoad() {
    os_log("LOGGING TEST BLAH BLAH", log: myLog)
    print("Starting ViewDidLoad")
    super.viewDidLoad()
    os_log("LOGGING TEST BLAH BLAH", log: myLog)'
...

However, I do not see anything on the XCode console - just the print ("Starting ViewDidLoad").

Is there a setting in XCode to echo messages from the logger that needs to be turned on?

I understand that Logger is the preferred method now instead of os_log, but both should echo the log messages on XCode debug console from what I can tell..

Thanks!

  • Note - I ran the same code on my iMac desktop with Xcode 12, and I got the expected output. Other logger messages (from Firebase/Analytics) are also showing up there. Clearly some output setting is different between the two...

Add a Comment

Replies

Found the issue I had set the following environment variable in my scheme: OS_ACTIVITY_MODE=disable. Removing this environment fixed it. Don't recall why exactly this variable had been set, so recording it here for reference.

Don't recall why exactly this variable had been set

Historically there was a problem where Xcode’s console would display all your process’s log output, which meant that the log entries you cared about were drowned out by log entries coming from system frameworsk. The workaround was to set OS_ACTIVITY_MODE to disable. Nowadays this isn’t necessary because Xcode’s console only shows you log output from the main executable.

Share and Enjoy

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