`Logger` dropping messages during iOS startup

I'm using the Swift Logger struct to log messages at startup of an iOS application.

Not infrequently log messages are dropped that I know must have been logged.

Below I include two screenshots from Console.app that were taken from the same build of the application. In both circumstances the application was launched into the background via a push notification with available content.

The first screenshot contains all of the logs that I expected.

In the second screenshot we see that the initialization log does not appear, even though I know that the object was initialized.

I am using the logger as follows:

let logger = Logger(subsystem: "com.mysubsystem", category: "cat")
logger.log(level: .default, "view did load")

I've wondered if I see dropped messages because lots of logs are being triggered at app startup. Is there a buffer size I can increase within Logger, or another way to debug why some log messages are not coming through?

The system log is a shared resource and it will definitely drop things if you log too enthusiastically. Probably the best info on this subject is the WWDC session I reference in Your Friend the System Log.

One thing to keep in mind is that log entries at the .default level will typically be persisted, and the persistent log has less ability to soak up log pressure. For stuff like view did load messages, I recommend the .debug log level.

Share and Enjoy

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

`Logger` dropping messages during iOS startup
 
 
Q