saleem-mirza / serilog-sinks-sqlite

A Serilog sink that writes to SQLite
Apache License 2.0
56 stars 44 forks source link

Suppress exceptions and backup file #50

Open ntavendale opened 1 month ago

ntavendale commented 1 month ago

Suppress exceptions and backup file so consuming app will not crash if database file is corrupted.

If app is killed during DB File access file can become corrupt generating a "malformed disk image" exception. If this happens during application startup app can crash.

Added in sink configuration options to

1) suppress exceptions and not crash. 2) Back up file using rollover naming conventions and .ERR extension.

Only does back up on initialization. If exception is caused by, say, not having write permissions on the file but still having create permissions for the folder, every attempt to access the file would create a new backup of the same corrupted file.