Rolling file LoggerProvider for .NET Logging(1 min read)

I have just released version 1.0 of the Rolling File Logger Provider as part of Essential Logging on Github, a port of my .NET diagnostics library across to Microsoft.Extensions.Logging.

To use, add the Essential.LoggerProvider.RollingFile package to your project via Nuget:

dotnet add package Essential.LoggerProvider.RollingFile

Then reference the namespace, and add the logger provider during host construction:

using Essential.LoggerProvider;

// ...

    .ConfigureLogging((hostContext, loggingBuilder) =>

Example output, using the default format (customisable):

Example - Rolling File Logger Provider

The project also includes a Hello File Logging example, using a worker BackgroundService and high performance logging.


The logger uses a custom template for the log file name, allowing it to roll based on the date, and a custom template for the log format.

  "Logging": {
    "RollingFile": {
      "FilePathTemplate": "{BaseDirectory}/{ApplicationName}-{DateTime:yyyy-MM-dd}.log",
      "IncludeScopes": true,
      "IsEnabled": true,
      "Template": "{DateTime:u} [{ThreadId}] {LogLevel} {CategoryName} {Id}: {Message}{ScopeList} {Exception}"

The template formatter includes different presentations of log information (log level, short code, event ID, scopes, etc), system information (thread, user, machine name, time, etc), and other values useful for logging (system directories, environment variables, etc).

Future directions

I'll be adding some functionality to integrate with my Syslog.StructuredData project, port more of my diagnostics trace listeners across as logger providers, and introduce some new ones.

One thought on “Rolling file LoggerProvider for .NET Logging(1 min read)

  1. Looks good! Maybe it’s my old eyes but the output is too small to make sense of and when enlarged just pixelates. Could you gives us a higher-res image or maybe sut and paste some output into the article? Thank you!

Leave a Reply

Your email address will not be published. Required fields are marked *