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"