Console app not showing info and debug logs

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.


When

os_log
is called, only the
error
type message is visible in the Console application.

Using Terminal, with the 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


Please can someone tell me what I'm missing and how can I view debug and info messages in the Console application?

Replies

Sure thing!


Filed Radar: 47667447

Anyone got an update on this? It's still not working in the new Xcode 11 betas. Really dissapointing, when you can't just use the tools for simple things like seeing log messages. I'm not seeing Debug or Info messages from the simulator in Console.


Slightly off topic, does anyone know how to enable Error and Fault messages on an OSLog? Are they supposed to be disabled out of the box when running a debug build? That doesn't seem right, but those OSLogType's are disabled for me, so I'm not seeing messages even in the Xcode output pane.

This is in relation to the simulator use case:

Unfortunately, this workaround doesn't seem to work.


I can confirm that when Xcode is used to debug the simulator, the ios app logs are not passed on to the console app (only visible within Xcode output area).
But, when i stop the build and let the simulator run on its own, I can see the ios app logs within the console app/log tool (xcrum simctl).

Is this a bug or is some setting in the project that blocks the propagation of app logs?


iOS 13.1

XCode 11.1 (11A1027)

Mac OS 10.14.6

Also filed FB7499453 since there's been no traction on this.

Found this blog:

https://www.iosdev.recipes/simulator/os_log/


saying

=> If you don't see

debug
level logs, that's because the "system" log level is set to
info
and can't be changed
, so you're only able to see them by specifically using
log stream
.


not sure if that's the intended behavior Apple has designed or a bug Apple cannot figure it out to fix.


Anyone has more details ? Thanks,


Is Apple able to fix this or should we start rolling our own solutions? I'm reading the logs of my app running on iPad(iOS 14.4), using the Console on MacOS (10.15.7), and not getting all the logs. Some times I get some logs, and some times I get not logs at all (from my app). I need the logs that are generated when the app is started by the system, so I can't debug it using Xcode.

I read the whole thread plus the docs, implemented the new unified logging, but no luck. I even get fewer messages with the new shiny architecture, than if I use NSLog.

Is Apple able to fix this … ?

I’m not aware of any ongoing problems with Console not showing logs from real devices attached via USB. The original issue here dates back several years and was definitely resolved. And the other bugs referenced upthread (r. 47667447 and FB7499453) all seem to relate to the simulator.

I'm reading the logs of my app running on iPad (iOS 14.4), using the Console on macOS (10.15.7), and not getting all the logs.

Unfortunately I’m not in a position to set up your exact test (DevForums has already consumed way too much of my day)-: but I did test this on up-to-date kit (Xcode 12.4 on macOS 11.4 talking to an iPhone 12 mini running iOS 14.6) and didn’t see any problems.

Share and Enjoy

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

I know this has been an epic long running thread, but just to clarify:

  1. There is still a bug where debug messages from the simulator do not show up in the console app (I see them fine in Xcode's console & have the console app debug/info options on). Also see them if I use the 'xcrun simctl spawn log stream' command line that was posted a couple years back.

  2. There is no way to do filtering of os_log messages inside Xcode, that is only supported in the console app (where they don't show up due to the above issue)

Thanks in advance! Just trying to decide if I want to invest in OSLog now.

-pj

It's 2023 and this bug is still present, hilarious but horrendous. Seems I need to brush Objective-C++ and integrate some sane solution like spdlogger, would be better.

I still have this bug. The logs only show up if you use error or fault which is a bit ridiculous.

The logs only show up if you use error or fault

That’s not my experience. I just ran this test with the latest beta tooling, to see what the current state of affairs is.

I’m on macOS 13.4.1 running Xcode 15.0b6 targeting its iOS 17.0 (beta) simulator. I created a small test app and wired a button up to this code:

let log = Logger(subsystem: "com.example.apple-samplecode.Test82736", category: "app")

func test() {
    log.debug("debug")
    log.info("info")
    log.log("default")
    log.error("error")
    log.fault("fault")
}

I ran the app from Xcode and clicked the button. Xcode 15 beta’s shiny new logging support showed all my log entries. Yay!

I stopped the app.

I ran the macOS Console app. On the left I selected the iOS 17 beta simulator. I then pasted subsystem:com.example.apple-samplecode.Test82736 into the search box, so I only see my log entries. I also made sure that both Action > Include Info Messages and Action > Include Debug Messages were checked.

In the simulator, I ran the app from the Home screen and clicked my test button.

In Console, I saw all the log entries except for the .debug level one:

type: info
time: 10:48:53.898313+0100
process: Test82736
subsystem: com.example.apple-samplecode.Test82736
category: app
message: info

type: default
time: 10:48:53.898340+0100
process: Test82736
subsystem: com.example.apple-samplecode.Test82736
category: app
message: default

type: error
time: 10:48:53.898355+0100
process: Test82736
subsystem: com.example.apple-samplecode.Test82736
category: app
message: error

type: fault
time: 10:48:53.898421+0100
process: Test82736
subsystem: com.example.apple-samplecode.Test82736
category: app
message: fault

I consider this absence of the .debug level message to be a bug.

I then quit Console and ran the following command in Terminal:

% xcrun simctl spawn booted log stream --debug --predicate 'subsystem == "com.example.apple-samplecode.Test82736"'
…
… Debug   … Test82736: [com.example.apple-samplecode.Test82736:app] debug
… Info    … Test82736: [com.example.apple-samplecode.Test82736:app] info
… Default … Test82736: [com.example.apple-samplecode.Test82736:app] default
… Error   … Test82736: [com.example.apple-samplecode.Test82736:app] error
… Fault   … Test82736: [com.example.apple-samplecode.Test82736:app] fault

IMPORTANT This uses booted, and thus assumes that you only have one simulator running.

As you can see, this shows all the log entries.


So, in summary, this seems to be working pretty well. Of all the cases I tested, the only problem was the lack of .debug level messages when using the macOS Console app.

I should file a bug about that but I can’t do it right now because I’d need to re-test while running macOS 14 beta, and I don’t have time today to set that up. If you have the latest macOS 14 beta installed, I’d appreciate you repeating my Console test and letting us know what you see.

Share and Enjoy

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

Hey, I had the same issue and i found out that you have to activate Info and Debug messages in Console App in the menu. Action -> Include Info Messages Action -> Include Debug Messages

This fixed the issue for me . Thanks

  • Cool. Thanks for sharing.

  • This is a correct answer.

Add a Comment

I too am seeing this issue where in the Console app (fine in Xcode) it won't show Logger debug message. Info ones are fine, OSLog works fine....

Running Xcode 15, MacOS 13.6, iOS 17.0.3 and WatchOS 10.0.2, its Apple Watch I'm trying to debug.

So, just to be clear:

  • If you run a test project on macOS, you see the .debug messages.

  • Likewise for a test project on iOS.

  • But not when you run one on watchOS.

Is that right?

That definitely rings various bells. I’m kinda fuzzy on the details but watchOS definitely limits logging for performance reasons. If you install the general watchOS logging profile — follow the instructions under WatchKit for watchOS on our Bug Reporting > Profiles and Logs page — does that help?

Share and Enjoy

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