Soenneker.Utils.LogPath 4.0.135

Prefix Reserved
dotnet add package Soenneker.Utils.LogPath --version 4.0.135
                    
NuGet\Install-Package Soenneker.Utils.LogPath -Version 4.0.135
                    
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="Soenneker.Utils.LogPath" Version="4.0.135" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Utils.LogPath" Version="4.0.135" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Utils.LogPath" />
                    
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 Soenneker.Utils.LogPath --version 4.0.135
                    
#r "nuget: Soenneker.Utils.LogPath, 4.0.135"
                    
#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 Soenneker.Utils.LogPath@4.0.135
                    
#: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=Soenneker.Utils.LogPath&version=4.0.135
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Utils.LogPath&version=4.0.135
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

alternate text is missing from this package README image 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:

  1. LOG_PATH/<fileName> when the LOG_PATH environment variable is set.
  2. Azure App Service's persistent LogFiles directory.
  3. <GITHUB_WORKSPACE>/logs in GitHub Actions.
  4. /var/log/app in another detected container.
  5. <AppContext.BaseDirectory>/logs as 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 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 (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.135 0 8/31/2026
4.0.134 0 8/30/2026
4.0.133 2,155 8/29/2026
4.0.132 45 8/29/2026
4.0.131 8,360 8/26/2026
4.0.130 589 8/26/2026
4.0.129 2,738 8/21/2026
4.0.128 5,858 8/18/2026
4.0.127 1,185 8/18/2026
4.0.126 4,825 8/12/2026
4.0.125 9,363 8/9/2026
4.0.124 3,661 8/8/2026
4.0.123 100 8/8/2026
4.0.122 4,652 8/7/2026
4.0.121 6,475 7/29/2026
4.0.120 1,392 7/29/2026
4.0.119 2,146 7/29/2026
4.0.118 3,605 7/28/2026
4.0.117 940 7/27/2026
4.0.116 7,347 7/19/2026
Loading failed

Clarify log path resolution