we're currently using Serilog as logging-framework in a .NET Core 3.1 console-application. Is it possible, that only the latest file does NOT have a timestamp/number appended to it. This means that Serilog would have to update the file as soon as a new log-file will be created.
Example with following config:
.WriteTo.File(
"application.log",
outputTemplate: "some example output template",
fileSizeLimitBytes: 1000,
rollOnFileSizeLimit: true)
Now the following files should get created/updated. Also I'll write an Id into brackets (#) for this example so you can differentiate them more easily:
Directory after creating 1st log-file: application.log (0)
Directory after creating 2nd log-file: application.log (1) | application_1.log (0)
Directory after creating 3rd log-file: application.log (2) | application_1.log (0) | application_2.log (1)
As you can see the latest file should always be called "application.log", while the other files names should get updated with some number/timestamp.
What is happening but should NOT be happening:
Directory after creating 1st log-file: application.log (0)
Directory after creating 2nd log-file: application_1.log (1) | application.log (0)
Directory after creating 3rd log-file: application_2.log (2) | application_1.log (1) | application.log (0)
As you can see the first file, that was created is always called "application.log", but not the latest that was created.
Is there any possibility to get the first behaviour with Serilog? Someone told me that this behaviour could be achieved with log4net, but I don't know if it's true and if possible I'd like to stick to Serilog.
And please do not ask me for reasons, because I don't know them (it's a client request). Also thank you in advance for every useful answer on this weird question! :)