Retrieving Logs from a Customer's Device

Apple Recommended

Replies

To add on a bit, what is the best way to get a log archive from a tester's device when they *don't* have access to Xcode? The specific instance that's been most troublesome for me has been when TestFlight users have a build, but aren't otherwise familiar - or after a beta when it's in the hands of a customer directly.
@heckj: a tester with access to a Mac can use log collect --device as seen in the talk to get a logarchive, even if they do not have Xcode. Using --start or --last limits the time range of the logs, which can limit the size of the resulting logarchive.
I went through a similar thing before WWDC this year. I wanted to start using unified logging but there is so much friction for an end user to send logs to a developer. I understand how it can be "simple" for a developer to connect their device to their Mac and run a terminal command to capture the logs.

But for an end user, think of how many of them might now have a Mac, have never opened Terminal, etc. There is no feasible way I can retrieve logs from them currently using OSLog.

There needs to be some ability to retrieve these logs directly on a device that the end user can send in an email or similar fashion. Some API that we can call that allows us to specify to "retrieve logs from past x minutes" or similar. I've created an enhancement request and would recommend anyone else do the same because I think this is something greatly needed to increase the usage of OSLog.
This new initializer on the OSLog framework’s OSLogStore class might help, but unfortunately many developers are experiencing a bug with it in beta 1, so you might not be able to assess its suitability right away.

(There are some doc comments in the OSLog/Store.h header.)
From what I understand OSLogStore is only available on macOS 11?
@bens OSLogStore is marked available in iOS 14: https://developer.apple.com/documentation/oslog/oslogstore?changes=latest_minor

Unfortunately, there is an issue with retrieving entries (the which I asked about during labs and have filed a Feedback Request for. Please duplicate if you get a chance!:
FB7787937

This is for the error message:
Code Block language
Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 0 named com.apple.OSLogService was invalidated."


I think it would be helpful to clarify the intended availability as some methods such as [getEntries(with:at:matching:)
](https://developer.apple.com/documentation/oslog/oslogstore/3204125-getentries) are marked as only available on macOS.
With iOS 14 beta 4, the error message has changed from
Code Block text
Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 0 named com.apple.OSLogService was invalidated." UserInfo={NSDebugDescription=The connection to service on pid 0 named com.apple.OSLogService was invalidated.}

to
Code Block text
Caught error: Error Domain=OSLogErrorDomain Code=9 "Client lacks entitlement to perform operation" UserInfo={NSLocalizedDescription=Client lacks entitlement to perform operation, _OSLogErrorInternalCode=14}


It doesn't appear that my Feedback (FB7868256) has been looked at, but, is this being fixed?