liveBook · Manning

Rolling interval

As explained in Building Web APIs with ASP.NET Core

A rolling interval is a file-sink setting that determines how often a new log file is created for subsequent events.

A rolling interval controls how often a file sink starts a new log file. With a daily interval, the sink creates one file for each day and timestamps filenames accordingly. section 7.4.5

Daily application logs

Configure Serilog’s file sink with `Logs/log.txt` and `rollingInterval: RollingInterval.Day`. The resulting files follow names such as `log20220518.txt` and `log20220519.txt`. section 7.4.5

Use a rolling interval when configuring a file sink:

  • Set `rollingInterval` to `RollingInterval.Day` when logs should be separated by calendar day. section 7.5.5
  • Run the application and inspect the `/Logs/` folder to verify that the expected dated file appears. section 7.4.5

How Building Web APIs with ASP.NET Core covers it

How deep it goes
Defines daily rotation, explains dated filenames, and verifies the resulting file, without detailing other interval values.
Examples
Uses `Logs/log.txt`, `RollingInterval.Day`, and dated files such as `log20220518.txt`.
What it assumes
Assumes familiarity with Serilog file sinks and introduces the interval setting through a concrete configuration.
What you can do after
Configure and verify daily Serilog file rotation in an application logging setup.
How it connects
Connects file sinks with Serilog configuration, output templates, log events, and log levels.

This explainer was generated by Manning's knowledge graph from the text of Building Web APIs with ASP.NET Core. The section links point to the parts of the book it draws on.