I'm working on a iOS/macOS project where I'm using CoreData. It works fine, but it outputs enormous amounts of debugging info to the Console. This makes the Console unusable, since my print statements are buried in all the CoreData related stuff.
I have a pretty simple CoreData setup with fetching of some data, so these are not errors, just general event logs it seems. I have the same results on other projects I have used CoreData.
Any way to reduce/remove this logging to the console?
Some sample data (all data here):
CoreData: warning: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _
performExportWithRequest:]_block_invoke_2(946): Finished export: <PFCloudKitExporter: 0x2838bd840>
CoreData: CloudKit: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _finishedRequest:withResult:](2102): Finished request: <NSCloudKitMirroringExportRequest: 0x2823bbb40> DC26CDEE-0AB6-42CD-81E5-996E7E7727F9 with result: <NSCloudKitMirroringResult: 0x282dfcfa0> success: 1 madeChanges: 0 error: (null)
CoreData: CloudKit: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _scheduleAutomatedExportWithLabel:activity:completionHandler:]_block_invoke(2170): <NSCloudKitMirroringDelegate: 0x281ae4580> - Finished automatic export - AppActivationExport - with result: <NSCloudKitMirroringResult: 0x282dfcfa0> success: 1 madeChanges: 0 error: (null)
CoreData: warning: CoreData+CloudKit: -[NSCloudKitMirroringDelegate finishedAutomatedRequestWithResult:](2115): Finished request '<NSCloudKitMirroringExportRequest: 0x2823bbb40> DC26CDEE-0AB6-42CD-81E5-996E7E7727F9' with result: <NSCloudKitMirroringResult: 0x282dfcfa0> success: 1 madeChanges: 0 error: (null)
CoreData: CloudKit: CoreData+CloudKit: -[NSCloudKitMirroringDelegate checkAndExecuteNextRequest](2073): <NSCloudKitMirroringDelegate: 0x281ae4580>: Checking for pending requests.
CoreData: CloudKit: CoreData+CloudKit: -[NSCloudKitMirroringDelegate checkAndExecuteNextRequest]_block_invoke(2088): <NSCloudKitMirroringDelegate: 0x281ae4580>: No more requests to execute.
CoreData: CloudKit: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _scheduleAutomatedImportWithLabel:activity:completionHandler:](2140): <NSCloudKitMirroringDelegate: 0x281ae4580> - Beginning automated import - ImportActivity - in response to activity:
<CKSchedulerActivity: 0x280ec8f00; additionalXPCActivityCriteria={
Priority = Utility;
}
Try adding these as launch arguments see if it helps
-com.apple.CoreData.SQLDebug 0
-com.apple.CoreData.Logging.stderr 0
-com.apple.CoreData.ConcurrencyDebug 0
-com.apple.CoreData.MigrationDebug 0
EDIT1: I found this in Apple docs: Choose Product > Scheme > Edit Scheme. Select an action such as Run, and select the Arguments tab. Pass the com.apple.CoreData.CloudKitDebug user default setting with a debug level value as an argument to the application.
-com.apple.CoreData.CloudKitDebug 0
Add this last one as a launch argument and you should achieve what you wanted.
link to the AppleDocs Check the section named Debug Errors in Core Data with CloudKit
I had the same problem.
This will disable CoreData debug output:
in 'Arguments passed on launch':-com.apple.CoreData.Logging.stderr 0
Worked for me.
Follow these steps in Xcode:
I guess you will see -com.apple.CoreData.SQLDebug
in 'Arguments passed on launch'. If you see that, turn it off. If you don't see it, add:
-com.apple.CoreData.SQLDebug 1
Values and descriptions:
From http://blog.raymccrae.scot/2017/12/core-data-sqldebug-log-levels.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With