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

{Date} includes literal {Date} in file-name #127

Closed
jgrandydev opened this issue Jan 27, 2020 · 4 comments
Closed

{Date} includes literal {Date} in file-name #127

jgrandydev opened this issue Jan 27, 2020 · 4 comments

Comments

@jgrandydev
Copy link

Asp.Net Core 2.2.0
Serilog 2.9.0
Serilog.Sinks.File 4.1.0

appSettings.json

"Serilog": {
  "WriteTo": [
    { "Name": "File",
      "Args": {
        "path": ".\\Logs\\MyApplication-{Date}.log",
        }
    }
  ],
},

File is created as MyApplication-{Date}20200127.log

@cocowalla
Copy link
Contributor

I think you're getting this sink mixed up with the deprecated serilog-sinks-rollingfile sink.

While serilog-sinks-rollingfile supported replacing the {Date} token with the actual date, this is no longer required with this sink - instead, if you configure rolling based on date, the date will automatically be added to the end of the filename.

@jgrandydev
Copy link
Author

But what if we want the date located somewhere other than the end of the filename ? And what if we want date formatted differently than yyyymmdd ?

@cocowalla
Copy link
Contributor

That's not supported OOTB, but I think you could achieve it with FileLifecycleHooks

@Deilan
Copy link

Deilan commented Sep 25, 2021

That's not supported OOTB

Went to #243

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