Closed xlone closed 1 year ago
Thanks for the suggestion!
There are a lot of things that can go wrong doing file I/O on different platforms; unfortunately some of the time, the OS will report an error that doesn't obviously point out the cause (as in this case).
Trying to detect the real error, and improve the message, is a battle we can't expect to win without a large investment of effort (if it's even winnable then), and we'd risk making the situation worse by drawing incorrect conclusions.
I think we're best off sticking with the status quo, here.
Closing as this issue does not seem actionable as it stands. If you or someone else can take the time to provide a detailed feature proposal as to how to add a mechanism for trapping things like this on a basis that is likely to work well across the plethora of ecosystems this Sink is deployed in https://www.nuget.org/packages/serilog.sinks.file
While configuring Serilog, I forgot to add the filename I wanted for the log file to the path setting. When this happens, the error returned is an access denied on the file path. This is not an intuitive error as I believed there was something wrong with my user having access to that path. Having an error that suggests that the filename is missing would be more helpful.