Pacem.Extensions.Logging.FileSystem 0.10.13

dotnet add package Pacem.Extensions.Logging.FileSystem --version 0.10.13
                    
NuGet\Install-Package Pacem.Extensions.Logging.FileSystem -Version 0.10.13
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Pacem.Extensions.Logging.FileSystem" Version="0.10.13" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Pacem.Extensions.Logging.FileSystem" Version="0.10.13" />
                    
Directory.Packages.props
<PackageReference Include="Pacem.Extensions.Logging.FileSystem" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Pacem.Extensions.Logging.FileSystem --version 0.10.13
                    
#r "nuget: Pacem.Extensions.Logging.FileSystem, 0.10.13"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Pacem.Extensions.Logging.FileSystem@0.10.13
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Pacem.Extensions.Logging.FileSystem&version=0.10.13
                    
Install as a Cake Addin
#tool nuget:?package=Pacem.Extensions.Logging.FileSystem&version=0.10.13
                    
Install as a Cake Tool

FileSystem Logging Extensions

⚗️ ==Experimental==

⚠️ Experimental libs are discouraged to use in production.

About

Pacem.Extensions.Logging.FileSystem provides extensions to write your logs to plain text files, with configurable line formatting and file-splitting (by date, level, category or any structured log value).

Log entries are queued and written by a background consumer, so logging calls never block on disk I/O.

ℹ️ This package was previously published as Pacem.Extensions.Logging.File. Replace that package reference — and any using Pacem.Extensions.Logging.File; — with the .FileSystem equivalents.

The following paragraphs exemplify the library utilization given common use cases.

How to

Add the relevant logger provider to the logging builder (e.g. ILoggingBuilder) and configure it through FileSystemLoggerOptions:

// Program.cs
builder.Logging.AddPacemFileSystemLogging(options =>
{
    // required: the folder log files are written into (created on first write)
    options.RootFolderPath = "/var/log/myapp";
});

With the defaults, an information entry from category MyApp.Worker lands in

/var/log/myapp/20260903_Information_log.txt

as the line

[2026-09-03T10:15:30.1234567+02:00] - Information - MyApp.Worker: Job started

Options

Option Default Purpose
RootFolderPath (required) Destination folder. Created automatically when missing.
Filename log.txt Base file name. The split criteria are prepended as a prefix.
FileSplitCriteria localDate + logLevel Ordered list that builds the file-name prefix — see below.
FileSizeLimit 0 (unlimited) Byte cap per file. When > 0 the default naming rolls to log001.txt, log002.txt, ... as each file fills up.
FormatMessage [{Timestamp}] - {LogLevel} - {Name}: {Message}\n payload => line. Return an empty/whitespace string to drop the entry from the file.
FormatFilename see remarks Low-level (payload, options) => fileName. Holds the prefix + size-limit logic; override with care.
Filter (none) Func<FileSystemLogPayload, bool> evaluated on the fully-built payload before it is queued. Return false to drop it.

File-splitting criteria

FileSplitCriteria is an ordered collection of strings. Each entry contributes one segment to the file-name prefix. Well-known values are exposed on KnownFileSplitCriteria:

Constant Value Segment
KnownFileSplitCriteria.LocalDate localDate yyyyMMdd, local time
KnownFileSplitCriteria.UtcDate utcDate yyyyMMdd, UTC
KnownFileSplitCriteria.LogLevel logLevel Information, Error, ...
KnownFileSplitCriteria.Name categoryName the logger category

ℹ️ Any other string is treated as a structured-log-value key: the logger looks it up among the message placeholders and, when found, uses its value as the segment (whitespace replaced with _).

builder.Logging.AddPacemFileSystemLogging(options =>
{
    options.RootFolderPath = "/var/log/myapp";

    // one file per tenant per day, e.g. 20260903_acme_log.txt
    options.FileSplitCriteria.Clear();
    options.FileSplitCriteria.Add(KnownFileSplitCriteria.LocalDate);
    options.FileSplitCriteria.Add("tenant");

    // cap each file at 5 MB and roll (20260903_acme_log001.txt, ...002.txt, ...)
    options.FileSizeLimit = 5 * 1024 * 1024;

    // only persist warnings and above
    options.Filter = log => log.LogLevel >= LogLevel.Warning;
});

// "tenant" is resolved from the structured placeholder
logger.LogWarning("Quota exceeded for {tenant}", "acme");

Plans for version next

Rolling retention (max file count / max age) and an opt-in JSON line format.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.10.13 0 9/3/2026
0.10.13-abel 31 9/3/2026
0.10.12 33 9/3/2026