Skip to content

What happened to retainedFileTimeLimit option #188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gokayokutucu opened this issue Nov 4, 2020 · 6 comments
Closed

What happened to retainedFileTimeLimit option #188

gokayokutucu opened this issue Nov 4, 2020 · 6 comments

Comments

@gokayokutucu
Copy link

Is retainedFileTimeLimit option removed or renamed? I need to delete files older than specified days. Is there any way to do it?

@nblumhardt
Copy link
Member

It's still there. You'll need to post what you've tried, and what error message you receive. HTH!

@gokayokutucu
Copy link
Author

I installed Serilog.Sinks.File 4.1.0, but this parameter does not appear when using configuration with code.
Here is the code that I used:

 new LoggerConfiguration()
                .ReadFrom.Configuration(configuration)
                .WriteTo.File(
                    path: "log-.log",
                    shared: true,
                    retainedFileCountLimit:100,
                    rollOnFileSizeLimit: fileSizeLimitBytes != 0,
                    fileSizeLimitBytes: fileSizeLimitBytes,
                    outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}{Exception}",
                    rollingInterval: RollingInterval.Day)
                .Enrich.FromLogContext()
                .CreateLogger();

@nblumhardt
Copy link
Member

Sorry, my mistake - you need the 5.0.0-dev* versions of the package for this.

@gokayokutucu
Copy link
Author

OK, thanks!

@hnigam-git
Copy link

@nblumhardt We have been waiting for this feature for long. When do you plan to merge this change to master?

@nblumhardt
Copy link
Member

Thanks for the nudge! How is the -dev package going for you? Does the feature work the way you need it to, @hnigam-git ?

Release PR is now open #210

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants