Closed alesshosry closed 4 years ago
Check your "MaxLogFileSize". It may happen that Convert.ToInt32(Configuration["MaxLogFileSize"])
gives a very small value.
No, the value is equal to 262144000 B = 250 MB; Please check the screenshot
It worked now. The issue was from my side: The LoggerConfiguration should be defined in the constructor to be defined once, while in my case I have defined it in the method that is called multiple times.
I am using serilog to log every request and response of my API. I am using .Net Core 2.1, and below is my code implemented in a middleware class:
The above code is working perfectly, except when I published the version on the webserver. I realized that SOMETIMES, multiple log files are generated at the same time, without reaching the max file size. When I opened those files, I found some info logged, and the time of logging is the exact time of each request. It seems, for this purpose many files are generated. Is it possible to fix this issue? Did I miss something in the LoggerConfiguration?
Thanks