Increase the unified logging stream buffer

We've been using ASL debugging logs without issue, but are now having problems with the new Unified Logging.


It appears that our debug logs are being truncated to 1k messages and our debug log messages exceed this. Our messages are JSON formatted, so we can parse them and they provide human readability in a clear format, so we don't want to have to break them up.


Updating our log function calls to the new logging functions makes no difference.


Am I right that the truncation is due to the size of the internal stream buffers and if so, is there a way to increase them?

Replies

The log message size limit is a documented feature of the API. The exact limit is discussed in the header comments for

os_log
in
<os/log.h>
. AFAIK there’s no way around this. The general recommendation is that you focus the logging on the critical aspects that would need to support in-the-field debugging.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Hi Quinn,


Thanks for replying so promptly and pointing me towards the documentation, but it doesn't appear to function according to the comments. Each log function has the same section in its comments: -


* There is a physical cap of 256 bytes per entry for dynamic content,

* i.e., %s and %@, that can be written to the persistence store. As such,

* all content exceeding the limit will be truncated before written to disk.

* Live streams will continue to show the full content.


According to the last line, it states that live streams should show full content, but I'm seeing this truncated to 1024 bytes, both on the command line and in the Console application, regardless of the logging function used.

In macOS 10.14, that comment in the header is a little different. The physical cap for dynamic content has been raised to 1024 bytes. Unfortunately, the Live streams will continue to show the full content remark has been removed. So, it's no longer a bug 😢