-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Yosemite: Log Fatal Errors to Sentry #2867
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just an initial question: I think it'd be nice for the message to show in Sentry directly, without having to find it from Encrypted Logs Console for each crash event. Not sure if there's a way to log the crash on Sentry without having to call fatalError
to exit the app which creates a duplicate crash on Sentry?
@jaclync My concern with that is we would end up with different error messages like the CoreDataManager Cannot Backup Store errors which causes Sentry to consider them as separate crashes. But it looks like this This |
Keeping this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
Code: ✅ (I was wondering where -force-crash-logging
comes from, and found it by searching in the code base)
Testing: ✅ (I also generated an installable build on a testing branch and got to see the event on Sentry and log in Encrypted logs console as well!)
Thanks, Jaclyn! |
This is supposed to help with diagnosing #2858. We should also do the same for Storage (#2364) and Networking (#2372).
Changes
I added a new function,
logErrorAndExit()
which usesDDLogError
andfatalError
internally. TheDDLogError
will be sent to the Encrypted Logs. ThefatalError()
will be sent to Sentry with just “Fatal error” like before. But now, the underlying message will be accessible in the Encrypted Logs. Read more about Encrypted Logging at paaHJt-1ms-p2.woocommerce-ios/Yosemite/Yosemite/Internal/LogErrorAndExit.swift
Lines 9 to 12 in 5732be3
Testing
Use the WooCommerce Alpha scheme.
Turn the
force-crash-logging
launch argument onAdd a breakpoint on this line of the Tracks
EventLogging+Sentry.swift
file.Change this line of the
OrderStatsV4Internal+Date
file to this so that it will crash later:Run and install the app on the simulator.
Log in. The app will crash.
Stop debugging.
Open the app on the simulator again. Not from Xcode. Open it a few times. This is to make sure that the crash will be queued.
Revert the change in Step 4.
Run the app from Xcode again.
The app should stop in the breakpoint in Step 3.
Capture and save the value of
logFile.uuid
.Let the app finish running so it will update the crash to Sentry.
Head to the Encrypted Logs Console.
Enter the
UUID
you captured in step 12 and click on View.Confirm that you see the error message like this:
Submitter Checklist
RELEASE-NOTES.txt
if necessary.