I want to switch from using print statements to using OSLog because of the filtering options and so on. I am using MusicKit. To mute all the log noise mostly coming from CoreData I pass these arguments on launch:
-com.apple.CoreData.SQLDebug 0
-com.apple.CoreData.MigrationDebug 0
-com.apple.CoreData.ConcurrencyDebug 0
-com.apple.CoreData.CloudKitDebug 0
-com.apple.CoreData.Logging.stderr 0
This works for all the Core Data related warnings but I also need such an argument for MusicKit. Setting the environment variable OS_ACTIVITY_MODE
to disable hides all the noise but also hides the log statements I sent via Logger().debug()
for example.
In particular these log messages appear in great quantities.
Attempted to register account monitor for types client is not authorized to access: {(
"com.apple.account.iTunesStore"
)}
<ICMonitoredAccountStore: 0x303c5c9f0> Failed to register for account monitoring. err=Error Domain=com.apple.accounts Code=7 "(null)"
My application works fine and these log messages mean absolutely nothing to me. These two threads mention a similar problem but can't offer a solution. https://forums.developer.apple.com/forums/thread/720835 https://forums.developer.apple.com/forums/thread/743795
Thank you
Please reply as a reply; it’s easy for me to miss comments. See Quinn’s Top Ten DevForums Tips for this and other titbits.
Thanks for that info. Xcode generally ignores log entries from Apple frameworks as a matter of policy (otherwise your Xcode console would look like the Console app!). These log entries are being shown because of their type, that is, fault and error.
I think it’d be reasonable for you to file a bug about these log entries, on the ground that they constitute log noise. If you do, please post your bug number, just for the record.
I was hoping that you might be able to suppress these logs using the OSLogPreferences
property, as described in Your Friend the System Log. However, I tested that today and it doesn’t work. I think that’s because Xcode’s console is hooking into the log system in a way that bypasses the normal filtering mechanism.
However, while playing around with that I noticed that the filter box at the bottom of Xcode’s console pane has a Recent Filters section, which does at least make it easy to re-apply your filter to suppress these log entries. Oh, and the applied filter persists from run-to-run of your app, which is actually a pretty reasonable workaround.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"