Home > Software engineering >  Maintaining a (single) stable filename using Serilog File sink
Maintaining a (single) stable filename using Serilog File sink

Time:01-14

I am logging the data like below :

.WriteTo.File("log.txt", rollOnFileSizeLimit: true,retainedFileCountLimit: 1,
                                             fileSizeLimitBytes: 10)

This creates a file set like this:

log.txt => log_001.txt => log_002.txt

Since I set retainedFileCountLimit = 1 once the log.text was deleted then log_001.txt

Is there any way to maintain only the log.log file instant of keeping int values in an increased format ?

CodePudding user response:

There is a forked sink, Serilog.Sinks.PersistentFile that does this.

But it's a very debatable ask which is why it's not supported by the standard Serilog.Sinks.File for the foreseeable future.

  • Related