serilog-extensions-logging-file icon indicating copy to clipboard operation
serilog-extensions-logging-file copied to clipboard

No rotation if size limit hits maximum

Open fuzolan opened this issue 6 years ago • 7 comments

My expectation is that a new file should be written if the size limit reaches the maximum. Instead log-messages are lost.

I use the component in a asp core 2 project. Configuration is in appsettings.json.

fuzolan avatar Jun 05 '18 09:06 fuzolan

I think we might look into enabling rollOnFileSizeLimit: true in this package :+1:

nblumhardt avatar Aug 23 '19 03:08 nblumhardt

I think we might look into enabling rollOnFileSizeLimit: true in this package 👍

Hi @nblumhardt This is exactly what I need. I am new to Serilog and I have read source code of this repo but cannot find (or don't know) how to put rollOnFileSizeLimit: true. Could you show me, where it should be put? Therefore, I can make my own fork and add that feature. This discussion is old and it seems that this feature request will not be implemented soon.

Thanks

firstyuyu avatar Dec 04 '20 02:12 firstyuyu

Hi @firstyuyu - it should be here I believe:

https://github.com/serilog/serilog-extensions-logging-file/blob/dev/src/Serilog.Extensions.Logging.File/Microsoft/Extensions/Logging/FileLoggerExtensions.cs#L146

HTH!

nblumhardt avatar Dec 04 '20 02:12 nblumhardt

Hi @firstyuyu - it should be here I believe:

https://github.com/serilog/serilog-extensions-logging-file/blob/dev/src/Serilog.Extensions.Logging.File/Microsoft/Extensions/Logging/FileLoggerExtensions.cs#L146

HTH!

Hi @nblumhardt ,

Thanks. For anyone who face this issue, I have forked this repo and add two optional parameters on AddFile extension method.

  • rollOnFileSizeLimit: the default value is true
  • rollingInterval: the default value is RollingInterval.Day

The nuget packet is here The forked repo is here

firstyuyu avatar Dec 04 '20 07:12 firstyuyu

Is there an update on officially implementing this in the main repo?

MikeRavenelle avatar Mar 22 '22 21:03 MikeRavenelle

@MikeRavenelle none at this point - a PR would be welcome if anyone is interested in taking a closer look.

nblumhardt avatar Mar 22 '22 22:03 nblumhardt