dfacto-lab / serilog-sinks-file

Serilog file sinks duplicated for file rolling
Apache License 2.0
14 stars 10 forks source link

The best overload for 'File' does not have a parameter named 'preserveLogFilename' #1

Closed KoalaBear84 closed 4 years ago

KoalaBear84 commented 4 years ago

Came from https://github.com/serilog/serilog-sinks-file/issues/40 and found out that I already had the correct nuget package.

Somehow I get this error.

Log.Logger = new LoggerConfiguration()
  .WriteTo.File("MyLogFile.log", rollingInterval: RollingInterval.Day, outputTemplate: outputTemplate, preserveLogFilename: true)
  .CreateLogger();

Somehow it does not see the preserveLogFilename parameter as mentioned on the readme.

I use .NET 5 RC1 with all the newest prereleases (if available), but still this problem.

Thanks in advance!

numito commented 4 years ago

Hello @KoalaBear84 ,

You need to compile the package yourself, if you use the original library you won't have the parameter. I will try to create a nugget package during the week.

Numa

KoalaBear84 commented 4 years ago

Aha, I didn't knew. I thought it was the original because of the readme stating to do the Install-Package Serilog.Sinks.File

So please (also) note something in the readme that this is not the official one and (currently) that you need to build it yourself.

I really dislike it that this is not provided by default. Also strange. Even if logging to file is not their main purpose, most of the time you (also) want to log to a local file, and with the same filename, especially when you are familiar with nlog/log4net. And not one that you need to drag in the tail tool every single day. 🤯🤷‍♂️🙃

numito commented 4 years ago

A package has been uploaded on nuget, you can try it out: https://www.nuget.org/packages/Serilog.Sinks.PersistentFile/

I have closed the issue. Please give it a try and report bugs