Skip to content
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

I want my Log file name in the format "D:\Log\FileName-{Date}-INew.txt" #298

Closed
amande4x opened this issue Oct 13, 2023 · 2 comments
Closed

Comments

@amande4x
Copy link

amande4x commented Oct 13, 2023

I want my generated text file name of format. "D:\Log\FileName-{Date}-INew.txt"
Currently its appending Date towards the end of the file,
"D:\Log\FileName-INew-20231010.txt"
Expected
"D:\Log\FileName-20231010-INew.txt"

            .WriteTo.Logger(l =>
            {
                l.WriteTo.File(
                        config.GetValue<string>(GenericConstants.TentFilePathKey)!,
                        rollingInterval: RollingInterval.Day,
                        retainedFileCountLimit: null,
                        outputTemplate: GenericConstants.LogOutputTemplateToken
                );
                l.Filter.ByIncludingOnly(e => e.Properties.ContainsKey(GenericConstants.NewFile));
            });
@bartelink bartelink transferred this issue from serilog/serilog Oct 14, 2023
@bartelink
Copy link
Member

bartelink commented Oct 14, 2023

Duplicate of #243 - the logic for generating filenames is definitely minimal in nature at present, but lots of people put up with that spartan nature.

Solving that would involve:

  • defining the possibilities to provide
  • defining a clear API/mechanism for specifying it
  • correlating the feature request with the current implementation to make sure it's implementable
  • implementing it

In particular, I'd read this reply from Nick, which outlines the thinking as to why the naming strategy is not necessarily something that there's appetite to add a lot of complexity to.

There are some forks too, which may have and/or consider adding such a facility, e.g. https://github.com/dfacto-lab/serilog-sinks-file

@bartelink
Copy link
Member

Had left this open in case you wanted to respond; assuming the above covers it

@bartelink bartelink closed this as not planned Won't fix, can't repro, duplicate, stale Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants