From 81095fb77d5f2f4f755d23b8db2d74038745a436 Mon Sep 17 00:00:00 2001 From: Warren Date: Tue, 31 Jul 2018 12:43:26 +0100 Subject: [PATCH] Adds an env variable (set to process level) so that the external config can use it to save files with a relative path --- src/Umbraco.Core/Logging/Logger.cs | 5 +++++ src/Umbraco.Web.UI/config/serilog.config | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Core/Logging/Logger.cs b/src/Umbraco.Core/Logging/Logger.cs index 84ebf7f529..7b172917d0 100644 --- a/src/Umbraco.Core/Logging/Logger.cs +++ b/src/Umbraco.Core/Logging/Logger.cs @@ -31,6 +31,11 @@ namespace Umbraco.Core.Logging { Serilog.Debugging.SelfLog.Enable(msg => System.Diagnostics.Debug.WriteLine(msg)); + //Set this environment variable - so that it can be used in external config file + //add key="serilog:write-to:RollingFile.pathFormat" value="%BASEDIR%\logs\log-{Date}.txt" /> + Environment.SetEnvironmentVariable("BASEDIR", AppDomain.CurrentDomain.BaseDirectory, EnvironmentVariableTarget.Process); + + Log.Logger = new LoggerConfiguration() .MinimumLevel.Debug() //Set to highest level of logging (as any sinks may want to restrict it to Errors only) .Enrich.WithProcessId() diff --git a/src/Umbraco.Web.UI/config/serilog.config b/src/Umbraco.Web.UI/config/serilog.config index 3345be319a..9465b6b6e5 100644 --- a/src/Umbraco.Web.UI/config/serilog.config +++ b/src/Umbraco.Web.UI/config/serilog.config @@ -6,7 +6,7 @@ - +