Soenneker.Utils.LogPath
4.0.142
Prefix Reserved
See the version list below for details.
dotnet add package Soenneker.Utils.LogPath --version 4.0.142
NuGet\Install-Package Soenneker.Utils.LogPath -Version 4.0.142
<PackageReference Include="Soenneker.Utils.LogPath" Version="4.0.142" />
<PackageVersion Include="Soenneker.Utils.LogPath" Version="4.0.142" />
<PackageReference Include="Soenneker.Utils.LogPath" />
paket add Soenneker.Utils.LogPath --version 4.0.142
#r "nuget: Soenneker.Utils.LogPath, 4.0.142"
#:package Soenneker.Utils.LogPath@4.0.142
#addin nuget:?package=Soenneker.Utils.LogPath&version=4.0.142
#tool nuget:?package=Soenneker.Utils.LogPath&version=4.0.142
Soenneker.Utils.LogPath
Chooses a writable log-file path for explicit, Azure App Service, GitHub Actions, container, and local application environments.
Installation
dotnet add package Soenneker.Utils.LogPath
Quick start
using Soenneker.Utils.LogPath;
Call the static LogPathUtil methods directly; no dependency-injection registration is required.
Usage
string logPath = await LogPathUtil.Get("application-.log", cancellationToken);
Log.Logger = new LoggerConfiguration()
.WriteTo.File(logPath, rollingInterval: RollingInterval.Day)
.CreateLogger();
Get returns a full path for the supplied file name. It does not create or open the log file.
Pass a file name rather than a rooted path or a path containing directory traversal segments.
Candidates are evaluated in this order:
LOG_PATH/<fileName>when theLOG_PATHenvironment variable is set.- Azure App Service's persistent
LogFilesdirectory. <GITHUB_WORKSPACE>/logsin GitHub Actions./var/log/appin another detected container.<AppContext.BaseDirectory>/logsas the fallback.
The explicit LOG_PATH override is returned as configured; the caller is responsible for making
sure that directory exists and is writable. For the environment-derived candidates, the utility
creates the directory and falls through when creation is denied or fails with an I/O error. The
final application-directory fallback can still throw if that location cannot be created.
Container detection is the asynchronous part of the operation and observes the cancellation token. Resolving a path does not guarantee a later file open will succeed because permissions or the filesystem can change afterward.
| 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
- Soenneker.Utils.Runtime (>= 4.0.1090)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Soenneker.Utils.LogPath:
| Package | Downloads |
|---|---|
|
Soenneker.Extensions.LoggerConfiguration
A set of useful Serilog LoggerConfiguration extension methods |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.144 | 0 | 9/5/2026 |
| 4.0.143 | 2,100 | 9/4/2026 |
| 4.0.142 | 2,619 | 9/4/2026 |
| 4.0.141 | 1,257 | 9/4/2026 |
| 4.0.140 | 42 | 9/4/2026 |
| 4.0.139 | 1,423 | 9/3/2026 |
| 4.0.138 | 5,636 | 8/31/2026 |
| 4.0.137 | 1,129 | 8/31/2026 |
| 4.0.136 | 152 | 8/31/2026 |
| 4.0.135 | 1,323 | 8/31/2026 |
| 4.0.134 | 558 | 8/30/2026 |
| 4.0.133 | 4,921 | 8/29/2026 |
| 4.0.132 | 86 | 8/29/2026 |
| 4.0.131 | 8,887 | 8/26/2026 |
| 4.0.130 | 613 | 8/26/2026 |
| 4.0.129 | 2,760 | 8/21/2026 |
| 4.0.128 | 5,864 | 8/18/2026 |
| 4.0.127 | 1,190 | 8/18/2026 |
| 4.0.126 | 4,830 | 8/12/2026 |
| 4.0.125 | 9,369 | 8/9/2026 |
Updated Multiple NuGet packages