OSLog Request: split long output into structured and stdio instead of dropping long printouts entirely?

OSLog’s structured logging is nice, but the output length is limited compared with stdio’s. Currently, it looks like if I expect long variable-length print-outs, I’m forced to revert to using stdio. —or is this just an Xcode 15 beta 2 bug (discussed in the release notes) and fixed versions will match what stdio gives me? If not, could there be a way to configure oslog to fall-back to stdio dynamicallty based on whether the printout is too long or not? A custom fallback buffer allocator? Alternatively, what if I could still get the structured logging with the metadata, and use stdio for the rest of the message that doesn’t fit? That would be a nice way to guarantee that you get structured logging info without dropping the entire message.

  • Your logging should be concise and informative to minimize resource over-usage during release or at least disabled. Now during development or debug builds, you can go crazy with the output. Follow the suggested workaround until the next beta resolution list is published.

  • @MobileTen I need to print what I need to print. It’s user-generated content, and I don’t intend to create a gui viewer at the moment. The question is whether the output is meant to have the same limit as stdio, or still less? I’m aware that it’s less than it should be given that it’s a known bug. Thanks!

Add a Comment

Replies

The system log doesn’t support arbitrarily long log entries, and it’s unlikely it ever will. During debugging you can enable long log entries — see Enable-Oversize-Messages in the os_log man page (section 5) — but even that has limits.

Share and Enjoy

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

  • @eskimo Why not push the over-the-limit string to stdio somehow so you don’t have to choose?

Add a Comment