How to fix the disastrous new Xcode 15 console
October 19 2023
This is a follow-up to my recent blog post Xcode 15logs nil as an empty string, not (null). I’ve now found three different bugs in the new Xcode 15 console.
FB13268283 Xcode 15console logs nil as empty string rather than (null) FB13270074 Console logs missing on first run after launching Xcode 15 FB13289059 Xcode 15 console logs truncated
In my opinion, the new Xcode 15console is awful, a disaster. Fortunately, I’ve found a way to restore the previous console behavior from Xcode 14 and earlier . This is actually noted in the Xcode 15 release notes, but I wanted to highlight the solution here in case, like me, you hadn’t read the release notes recently:
Console New Features By default, Xcode streams os_logs through the unified logging and activity tracing infrastructure. The output may be formatted differently compared to previous versions of Xcode, and its order relative to standard IO may also change. To customize the behavior of logging, edit the Run scheme action to set the environment variable IDELogRedirectionPolicy . The value “ oslogToStdio ” redirects os_log messages to standard IO and formats them in a style identical to previous versions of Xcode . The value stdioToOSLog redirects standard IO to the os_log messages, and presents them in the debug console with additional metadata. (109380695) Resolved Issues Fixed: The debug console’s action to jump from an os_log message to the line of source code which emitted it is only supported when debugging executables on the local Mac or Simulators . The menu item is disabled when debugging executables on connected devices. ( 109171925 )
The maximum permitted size of os_log messages shown in the debug console is smaller than in previous Xcode versions. This may cause long messages to more commonly appear truncated in the debug console. ( 109381234)
You need to set the environment variable IDELogRedirectionPolicy to the value oslogToStdio in the Run section of your app’s Xcodescheme. I wish there were a way to make this behavior the default in Xcode Settings ! ( FB13289075 Provide a setting to make oslogToStdio the default.)
Incidentally, I’m not sure how the release notes can say that "This may cause long messages to more commonly appear truncated in the debug console" is among the "Resolved issues", for it’s still very much an unresolved issue.