Skip to content

Map ignores retainedFileCountLimit #29

@markat1

Description

@markat1

Hi,
I have a problem regarding limiting the number of log files.

I have retainedFileCountLimit 2, but map seems to ignore this rule. Unfortunately it creates more than 2 files.

 .WriteTo.Async(a =>
            {
                a.Map<string>(
                    e => DateTime.Now.ToString("dd_MM_yyyy"),
                    (v, wt) => wt.File($"{AppDomain.CurrentDomain.BaseDirectory}/logs/log_{v}.txt",
                                       retainedFileCountLimit: 2,
                                       outputTemplate: "[{Timestamp:dd/MM/yyyy HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}",
                                       buffered: true,
                                       fileSizeLimitBytes: 105000000),
                    sinkMapCountLimit: 1);
            }, bufferSize: 120000)

it should only have been 2 files, but I see 3 files:

log_15_05_2021.txt
log_16_05_2021.txt
log_17_05_2021.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions