NickCraver/StackExchange.Exceptional

Clear all errors in store

VoidMonk opened this issue · 2 comments

Hi, does the 'Clear all non-protected errors' action permanently delete all errors in the configured stored?

It doesn't seem to be doing that with the PostgreSQL store, but there's a DeletionDate column in the Errors table of the store, so is it marked for auto-deletion?

Please help clear the doubt. Thanks.

Hi Ash,
For database stores it only does a "soft delete", meaning that they will no longer be visible in the UI, but they will still exist in the database. For the default memory store and JSON file store, those are permanently deleted at that point since there's a definite cost to keeping old errors around in those cases.

If keeping soft deleted errors in the database is something you don't want to do, it's pretty simple to set up a procedure that will just delete all of the errors that have a non null DeletionDate and you can then just execute that procedure on a regular basis to clear it up. You could even have a procedure that just deletes all non-protected errors, or all of the errors that are more than some number of days old. Alternatively, you could also download the source and change the SQL that gets executed when deleting the errors so that it will just delete them instead of setting the DeletionDate. 😉

Thanks for clarifying @CptRobby. The "soft delete" behaviour wasn't clear from the docs. I'll set-up a cron job to periodically purge old errors.