The retained file count limit being set to 1 seems to cause a locking issue the first time the file is written to as it is trying to delete and write concurrently.
Internal Error with Serilog: 2023-09-13T09:32:23.6593293Z Error System.IO.IOException: The process cannot access the file '<FILEPATH>\error.log' because it is being used by another process.
at System.IO.FileSystem.DeleteFile(String fullPath)
at Serilog.Sinks.PersistentFile.RollingFileSink.ApplyRetentionPolicy(String currentFilePath) while removing obsolete log file <FILEPATH>\error.log
The retained file count limit being set to 1 seems to cause a locking issue the first time the file is written to as it is trying to delete and write concurrently.