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
<PackageReference Include="Pacem.Extensions.Logging.FileSystem" Version="0.10.13" />
<PackageVersion Include="Pacem.Extensions.Logging.FileSystem" Version="0.10.13" />
<PackageReference Include="Pacem.Extensions.Logging.FileSystem" />
paket add Pacem.Extensions.Logging.FileSystem --version 0.10.13
#r "nuget: Pacem.Extensions.Logging.FileSystem, 0.10.13"
#:package Pacem.Extensions.Logging.FileSystem@0.10.13
#addin nuget:?package=Pacem.Extensions.Logging.FileSystem&version=0.10.13
#tool nuget:?package=Pacem.Extensions.Logging.FileSystem&version=0.10.13
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 anyusing Pacem.Extensions.Logging.File;— with the.FileSystemequivalents.
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 | Versions 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. |
-
net10.0
- Pacem.Extensions.Logging (>= 0.10.13)
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 |