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

rollOnFileSizeLimit value is not being used #184

Closed
PedroS11 opened this issue Jun 4, 2019 · 1 comment
Closed

rollOnFileSizeLimit value is not being used #184

PedroS11 opened this issue Jun 4, 2019 · 1 comment

Comments

@PedroS11
Copy link

PedroS11 commented Jun 4, 2019

In my appsettings.json I have this

{
 "Serilog": {
    "MinimumLevel": "Fatal",
    "WriteTo": [
      {
        "Name": "RollingFile",
        "Args": {
          "pathFormat": "..\\Logs\\log-{Date}.txt",
          "rollingInterval": "Day",
          "retainedFileCountLimit": 31,
          "fileSizeLimitBytes": 1024,
          "rollOnFileSizeLimit": true,
          "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] {Message}{NewLine}{Exception}{NewLine}"
        }
      }
    ],
    "Properties": {
      "Application": "Common feature in WebApi demo"
    }
  }
}

And only one file per day is created when I do multiple requests and exceed the 1Kb limit. What am I doing wrong? I wanted the files *_001.txt being created

@PedroS11
Copy link
Author

PedroS11 commented Jun 4, 2019

It's fixed, I was using a deprecated nugget (RollingFile)
Now I use Serilog.Sink.File with the folling appsettings.json file

{
 "Serilog": {
    "MinimumLevel": "Fatal",
    "WriteTo": [
      {
        "Name": "File", //<-------
        "Args": {
          "path": "..\\Logs\\log-{Date}.txt", // <------
          "rollingInterval": "Day",
          "retainedFileCountLimit": 31,
          "fileSizeLimitBytes": 1024,
          "rollOnFileSizeLimit": true,
          "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] {Message}{NewLine}{Exception}{NewLine}"
        }
      }
    ],
    "Properties": {
      "Application": "Common feature in WebApi demo"
    }
  }
}

@PedroS11 PedroS11 closed this as completed Jun 4, 2019
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

1 participant