Skip to content

Async to remove old log file #306

Open
@SpringHgui

Description

@SpringHgui

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. For example, "I'd like to do x but currently I can't because y [...]".

  1. At the beginning of the project, my configuration was like this,72 log files will be retained
 configuration
    .WriteTo.File($"Logs/log-.log",
        rollingInterval: RollingInterval.Day,
        retainedFileCountLimit: 72 ,
        shared: false,
        outputTemplate: temp);
  1. Since the log file is relatively large, compression is used for archiving.
    my configuration was like this,2 log files will be retained and 70 compressed log files, ArchiveHooks
 configuration
    .WriteTo.File($"Logs/log-.log",
        rollingInterval: RollingInterval.Day,
        retainedFileCountLimit: 2,
        shared: false, hooks: new ArchiveHooks(70),
        outputTemplate: temp);

  1. Everything looked fine, but when I upgraded the program to a production environment, the program blocked on startup. Unable to complete startup after several minutes
  2. The first startup after the program upgrade requires compressing 70 files, which takes a lot of time. The program will be blocked until this deleting work is completed

Describe the solution you'd like

Archive files are usually compressed or copied, which takes a lot of time. During this period, the main program should not be blocked from starting. Async to remove old log file supported

System.IO.File.Copy(path, newFile, false);

Describe alternatives you've considered
A clear and concise description of any workarounds or alternative solutions you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions