BedeGaming / sinks-rollingfile

A serilog sink for rolling files based on size and time
Apache License 2.0
15 stars 20 forks source link

UnauthorizedAccessException from SizeLimitedFileSink #37

Open PhilipJRussell opened 7 years ago

PhilipJRussell commented 7 years ago

If SizeLimitedFileSink cannot open a file for writing, it's possible to get a System.UnauthorizedAccessException.

This was noticed during Zeus QA02 migration where a log file was initially created by a different account context, leaving the application pool identity unable to access it. As the exception is thrown in the constructor it crashed the tenant.

If the exception is thrown we think it should attempt at least once to create a new file.